format of fake calls
 [
   [:get, "/accounts/id", {}, { id: 123, nickname: '123' ... }]
 ]
425706
def fake!(fake_calls = [])
      @fake_calls = fake_calls
      @fake = true
      Quovo.config.token_storage = Object.new.tap do |o|
        def o.read(_)
          ['FAKE-TOKEN', (Time.now.utc + 1_000).iso8601].join('|')
        end
      end
    end
498520
def base_web_method_call( web_options, options ={}, url )
      options     = Smile::ParamConverter.clean_hash_keys( options )
      web_options = Smile::ParamConverter.clean_hash_keys( web_options )

      params = default_params.merge( web_options )
      params.merge!( options ) if( options )

      logger.info( params.inspect )

      json = RestClient.post( url, params ).body
      upper_hash_to_lower_hash( Smile::Json.parse( json ) )
		end
1309120
function mockHash( str ) {
		// It may be a null or empty string.
		if ( !str )
			return {};

		var keys = str.split( /\s*,\s*/ ).sort(),
			obj = {};

		while ( keys.length )
			obj[ keys.shift() ] = TEST_VALUE;

		return obj;
	}
1074346
function callsites() {
	var _ = Error.prepareStackTrace;
	Error.prepareStackTrace = function (_, stack) {
		return stack;
	};
	var stack = new Error().stack.slice(1);
	Error.prepareStackTrace = _;
	return stack;
}
43295
def auth_url
      auth_call = prepare_api_call("", :params=>{:api_key=>@api_key},
        :base_url=>ODESK_AUTH_URL, :format=>nil, :method=>:get, :auth=>false)
      data = auth_call[:params].to_a.map{|pair| pair.join '='}.join('&')
      return auth_call[:url]+"?"+data
    end
1008196
function _identifiers (options) {
  var query = {}

  for (var prop in options.hash) {
    if (/^-/.test(prop)) {
      query[prop.replace(/^-/, '!')] = options.hash[prop]
    } else if (/^_/.test(prop)) {
      query[prop.replace(/^_/, '')] = new RegExp(options.hash[prop])
    } else {
      query[prop] = options.hash[prop]
    }
  }
  return arrayify(options.data.root).filter(where(query))
}
1006390
def get_blacklist
      params = {
        :method => WebPurify::Constants.methods[:get_blacklist]
      }
      parsed = WebPurify::Request.query(text_request_base, @query_base, params)
      if parsed[:word]
        return [] << parsed[:word]
      else
        return []
      end
    end
737447
function formatResponse(response) {
  var info, user, dbname, auth;
  info   = url.parse(response.uri);
  auth   = encodeURIComponent(info.auth);
  user   = auth.replace(/%3A/i, ':').split(':');
  dbname = response.name;

  var database = {
    id: dbname,
    host: info.hostname,
    port: Number(info.port),
    uri: 'mongodb://' + info.auth + '@' + info.host,
    username: decodeURIComponent(user[0]),
    password: decodeURIComponent(user[1]),
    dbname: dbname
  };
  return database;
}
727623
def do_fake_filter( formatter, arg=None ):
    
    args = []
    if not arg is None: args.append(arg)
    return Faker.getGenerator().format( formatter, *args )
53150
def accounts_spec(self):
        """"""
        formatted_account_id = formatted(valid_account_id(), MergedOptionStringFormatter, expected_type=string_types)
        return dictof(string_spec(), formatted_account_id)
734752
function(str, index) {
    // replace {{ xxx }}
    var obj = this
    str = str.replace(interpolateReg, function(match, interpolate) {
      try {
        /*jslint evil: true */
        var funcNames = ['','index'].concat(fakerFuncNames).concat(['return ' + interpolate + ';']),
        func = new (Function.prototype.bind.apply(Function, funcNames)),
        funcs = [function(){return index}].concat(fakerFuncs);

        return func.apply(obj, funcs);
        
      } catch(e)  {
        return e.message;
      }
    });

    // if result is true or false, parse it to boolean
    if(/^(true|false)$/.test(str)) {
      str = str === 'true';
    }

    // if result is digit, parse it to float
    if(/^[-+]?\d*\.?\d+$/.test(str)) {
      str = parseFloat(str);
    }

    return str;
  }
490420
def authenticate
      # Take the user id (eg integer 1000) make a string out of it "1000", take
      # each character and determin hex value "1" => 0x31, "0" => 0x30. You
      # obtain for "1000" => 31303030 This is what the server is expecting.
      # Why? I dunno. How did I come to that conclusion? by looking at rbus
      # code. I have no idea how he found that out.
      Process.uid.to_s.split(//).map { |d| d.ord.to_s(16) }.join
    end
686637
def get_call_1_2(url)
      url = "1.2/#{url}"
      response = connection.get(url) {|request| set_headers(request)}
      parse_response(response)
    end
1051038
function () {
            return [
                        __.filter (123, _.constant (456)).assert (456),
                        __.filter (['foo', 456], _.isString).assert (['foo']),
                        __.filter (['foo', 456], __.constant ('baz')).assert (['baz', 'baz']),
                        __.filter ({ foo: 123, bar: '456' }, _.isNumber).assert ({ foo: 123 })
                    ] }
304338
function urlJoin() {
    var args = Array.prototype.slice.call(arguments),
        prefixDoubleSlash = false,
        url;

    // Remove empty item at the beginning
    if (args[0] === '') {
        args.shift();
    }

    // Handle schemeless protocols
    if (args[0].indexOf('//') === 0) {
        prefixDoubleSlash = true;
    }

    // join the elements using a slash
    url = args.join('/');

    // Fix multiple slashes
    url = url.replace(/(^|[^:])\/\/+/g, '$1/');

    // Put the double slash back at the beginning if this was a schemeless protocol
    if (prefixDoubleSlash) {
        url = url.replace(/^\//, '//');
    }

    url = deduplicateSubDir(url);
    return url;
}
988408
function getRemoteMethodOutput(method) {

    let returnType = 'JSON';
    let list = false;

    if (method.returns && method.returns[0]) {
        if (!SCALARS[method.returns[0].type] && typeof method.returns[0].type !== 'object') {
            returnType = `${method.returns[0].type}`;
        } else {
            returnType = `${method.returns[0].type}`;
            if (_.isArray(method.returns[0].type) && _.isString(method.returns[0].type[0])) {
                returnType = method.returns[0].type[0];
                list = true;
            } else if (typeof method.returns[0].type === 'object') {
                returnType = 'JSON';
            }
        }
    }

    let type = exchangeTypes[returnType] || returnType;
    type = (list) ? getConnection(type) : getType(type);
    type = type || getType('JSON');

    return {
        type,
        list
    };
}
227684
function fakeHash( record ) {
    // Not a real hash function - do not use in production
    return new Promise( (resolve, reject) => {
        if(!record) {
            return reject('record not defined');
        }
        if(!record.password) {
            return reject('record.password not defined');
        }
        // fake hashing - do not use in production
        record.password = '$' + getRandomInt(10000, 10000000);
        resolve(record);
    });
}