patch a resource
@param  {string} argv[2] The URI to be patched
@param  {string} argv[3] The data to patch
430423
function bin(argv) {

  var patchURI = argv[2]
  var patch    = argv[3]

  shell.patch(patchURI, patch, function(err, res) {
    if (err) {
      console.error(err)
    } else {
      console.log(res)
    }
  })
}
856003
public static void main(String argv[]) throws Exception {
    DnsMonitorSecurityManager.setTheManager();
    AvatarZKShell shell = null;

    shell = new AvatarZKShell();
    int res;
    try {
      res = ToolRunner.run(shell, argv);
    } finally {
      shell.close();
    }
    System.exit(res);
  }
331533
def patch(path, options = {}, &block)
      perform_request Net::HTTP::Patch, path, options, &block
    end
86555
function help (argv, callback) {
  var ret = 'rdf help\n'
  ret += 'commands\n'
  ret += '  rdf cat <uri>                    - displays a uri\n'
  ret += '  rdf cp <source> <dest>           - copies from source to dest uris\n'
  ret += '  rdf help                         - shows help message\n'
  ret += '  rdf ls <uri>                     - shows files in a container\n'
  ret += '  rdf mv <source> <dest>           - moves from source to dest uris\n'
  ret += '  rdf obj <uri> [value]            - watches the first found object\n'
  ret += '  rdf patch <uri> <data>           - patch turtle data to a file\n'
  ret += '  rdf post <uri> <data>            - posts turtle data to a file\n'
  ret += '  rdf put <uri> <data>             - puts turtle data to a file\n'
  ret += '  rdf rm <uri>                     - removes a uri\n'
  ret += '  rdf sub <uri>                    - subscribes to a uri\n'
  ret += '  rdf tail <uri>                   - watches a URI for changes\n'
  ret += '  rdf touch <uri>                  - touches a uri\n'
  ret += '  rdf ws <uri>                     - tests websocket to a uri\n'
  callback(null, ret)
}
1041011
function(request /*, moreArguments */) {
        // Store arguments for use within the closure below
        var args = arguments;

        // Rewrite /websocket and /websocket/ urls to /sockjs/websocket while
        // preserving query string.
        var parsedUrl = url.parse(request.url);
        if (parsedUrl.pathname === pathPrefix + '/websocket' ||
            parsedUrl.pathname === pathPrefix + '/websocket/') {
          parsedUrl.pathname = self.prefix + '/websocket';
          request.url = url.format(parsedUrl);
        }
        _.each(oldHttpServerListeners, function(oldListener) {
          oldListener.apply(httpServer, args);
        });
      }
539862
function(argv, context, callback) {
  return MongoClient.connect(mongoHost, function(err, db) {
    if (err) { return sg.die(err, callback, 'upsertPartner.MongoClient.connect'); }

    var partnersDb  = db.collection('partners');
    var partnerId   = argvGet(argv, 'partner-id,partner');

    var item = {};

    _.each(argv, (value, key) => {
      sg.setOnn(item, ['$set', sg.toCamelCase(key)], sg.smartValue(value));
    });

    everbose(2, `Upserting partner: ${partnerId}`);
    return partnersDb.updateOne({partnerId}, item, {upsert:true}, function(err, result) {
      if (err)  { console.error(err); }

      db.close();
      return callback(err, result.result);
    });
  });
}
1120759
def add_patch(self, *args, **kwargs):
        
        return self.add_route(hdrs.METH_PATCH, *args, **kwargs)
125401
function tail (argv, callback) {
  if (!argv[2]) {
    console.error('url is required')
    console.error('Usage : tail <url>')
    process.exit(-1)
  }
  var uri = argv[2]
  var wss = 'wss://' + uri.split('/')[2] + '/'

  var s = new ws(wss, {
    origin: 'http://websocket.org'
  })

  s.on('open', function open () {
    s.send('sub ' + uri)
  })

  s.on('close', function close () {
    console.log('disconnected')
  })

  s.on('message', function message (data, flags) {
    var a = data.split(' ')
    if (a.length && a[0] === 'pub') {
      util.get(a[1], function (err, res) {
        if (err) {
          console.error('Error : ' + err)
        } else {
          console.log(res)
        }
      })
    }
  })
}
62756
function interpolate (args) {
  var substr = this.match(rtplVars)
  var result = this
  var vars
  var argv

  if (isObject(args)) {
   argv = args
 } else if (Array.isArray(args)) {
   argv = argv = args
  } else if (arguments.length) {
   argv = [].slice.call(arguments)
  }

  if (substr == undefined || !Array.isArray(argv) && !isObject(argv)) {
   return this.toString()
  }

  vars = substr.map(function (str) {
   return str.replace(/(^[$#]\{)|(\}$)/g, '')
  })

  if (isObject(argv) || Array.isArray(argv)) {
   for (var i = 0, len = substr.length; i < len; i++) {
     result = result.replace(substr[i], argv[vars[i]])
   }
  }

  return result
}
227342
function updateUrlParameter (uri, key, value) {
	// remove the hash part before operating on the uri
	var
		i = uri.indexOf('#'),
		hash = i === -1 ? '' : uri.substr(i)
		;

	uri = i === -1 ? uri : uri.substr(0, i);

	var
		re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"),
		separator = uri.indexOf('?') !== -1 ? "&" : "?"
		;

	if (!value) {
		// remove key-value pair if value is empty
		uri = uri.replace(new RegExp("([?&]?)" + key + "=[^&]*", "i"), '');

		if (uri.slice(-1) === '?') {
			uri = uri.slice(0, -1);
		}
		// replace first occurrence of & by ? if no ? is present

		if (uri.indexOf('?') === -1) {
			uri = uri.replace(/&/, '?');
		}

	} else if (uri.match(re)) {
		uri = uri.replace(re, '$1' + key + "=" + value + '$2');
	} else {
		uri = uri + separator + key + "=" + value;
	}
	return uri + hash;
}
142173
function setConfig (argv) {
    var configLookup = {}

    // expand defaults/aliases, in-case any happen to reference
    // the config.json file.
    applyDefaultsAndAliases(configLookup, flags.aliases, defaults)

    Object.keys(flags.configs).forEach(function (configKey) {
      var configPath = argv[configKey] || configLookup[configKey]
      if (configPath) {
        try {
          var config = null
          var resolvedConfigPath = path.resolve(process.cwd(), configPath)

          if (typeof flags.configs[configKey] === 'function') {
            try {
              config = flags.configs[configKey](resolvedConfigPath)
            } catch (e) {
              config = e
            }
            if (config instanceof Error) {
              error = config
              return
            }
          } else {
            config = require(resolvedConfigPath)
          }

          setConfigObject(config)
        } catch (ex) {
          if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath))
        }
      }
    })
  }
310731
function patch(obj, method, optionsArgIndex) {
    var orig = obj[method];
    if (!orig) return;
    obj[method] = function () {
      var opts = arguments[optionsArgIndex];
      var file = null;
      if (opts) {
        file = typeof opts == 'string' ? opts : opts.filename;
      }
      if (file) callback(file);
      return orig.apply(this, arguments);
    };
  }
16839
function patchMeta(uri, data) {
  const id = replaceVersion(uri.replace('/meta', ''));

  return db.patchMeta(id, data)
    .then(() => getMeta(uri))
    .then(pubToBus(id));
}
1219133
public static void main(String argv[])
    {
        String srcFile = "randam_orig.png";
        try
        {
            System.out.println("Reading: "+srcFile);
            BufferedImage src = ImageIO.read(new File(srcFile));
            ImageScale3x scaler = new ImageScale3x(src);
            BufferedImage out = scaler.getScaledImage();

            String outFile = srcFile.substring(0,srcFile.length()-4);
            outFile += "3x";
            outFile += ".png";
            System.out.println("Writing: "+outFile);
            ImageIO.write(out,"PNG",new File(outFile));
        } 
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
777432
function argv(k) {
		if (!nargv) {
			nargv = process.argv.slice(0, 2);
		}
		var v = '', m = null;
		var x = new RegExp(k + regexKeyVal.source);
		nargv.every(function(e) {
			m = e.match(x);
			if (m && m.length) {
				v = m[0];
				return false;
			}
		});
		return v;
	}
561184
def uri(resource, args = {})
      uri = resource.uri(args)

      query_values  = args[:query]   || {}
      header_values = args[:headers] || {}

      params.each { |param|
        name = param.name

        if param.style == 'header'
          value = header_values[name] || header_values[name.to_sym]
          value = param % value

          uri.headers[name] = value if value
        else
          value = query_values[name] || query_values[name.to_sym]
          value = param.format(value, nil, 'query')

          uri.query << value if value && !value.empty?
        end
      }

      uri
    end
840563
function (args, callback) {
        if (ternserver) {
          var query =
            {
              type: "beautify",  //$NON-NLS-1$
              file: args.meta.location,
              args: {
                config: args.config,
                start: args.start,
                end: args.end,
                contentType: args.contentType
              }
            };
          ternserver.request(
            {
              query: query,
              files: args.files
            },
            function (error, text) {
              if (error) {
                callback({request: 'beautify', error: error.message, message: Messages['failedToFormat']}); //$NON-NLS-1$
              } else if (text) {
                callback({request: 'beautify', text: text}); //$NON-NLS-1$
              } else {
                callback({request: 'beautify', text: ""}); //$NON-NLS-1$
              }
            }
          );
        } else {
          callback(null, {message: Messages['failedToFormatNoServer']});
        }
      }