Adapted from Rackup
482829
def daemonize!
      if JRUBY
        # It's not a true daemon but when executed with & works like one
        thread = Thread.new {daemon_execute}
        thread.join

      elsif RUBY_VERSION < "1.9"
        logger.debug "Parent Process: #{Process.pid}"
        exit!(0) if fork
        logger.debug "Child Process: #{Process.pid}"
        daemon_execute

      else
        Process.daemon(true, true)
        daemon_execute
      end
    end
118157
def repmat(x, r, c):
    '''
    
    '''
    if sps.issparse(x):
        row = sps.hstack([x for _ in range(c)])
        return sps.vstack([row for _ in range(r)], format=x.format)
    else: return np.matlib.repmat(x, r, c)
1358862
def add_stack(limit: nil, stack: Kernel.caller)
      frame_count = 0
      @data[:stack] = []

      stack.each do |i|
        # If the stack has the full instana gem version in it's path
        # then don't include that frame. Also don't exclude the Rack module.
        if !i.match(/instana\/instrumentation\/rack.rb/).nil? ||
          (i.match(::Instana::VERSION_FULL).nil? && i.match('lib/instana/').nil?)

          break if limit && frame_count >= limit

          x = i.split(':')

          @data[:stack] << {
            :c => x[0],
            :n => x[1],
            :m => x[2]
          }
         frame_count = frame_count + 1 if limit
        end
      end
    end
951777
def _call( env )
      request = Rack::Request.new(env.dup)
      env.merge! "rack.jquery.organisation" => @organisation
      env.merge! "rack.jquery.raise" => @raise
      if request.path_info == @http_path_to_jquery.to_path
        response = respond_with_local_file JQUERY_FILE_NAME, request
        response.headers.merge!("X-SourceMap" => @http_path_to_source_map.to_path) if @source_map
        response.finish
      elsif request.path_info == @http_path_to_source_map.to_path
        response = respond_with_local_file JQUERY_SOURCE_MAP_FILE_NAME, request
        response.finish
      else
        @app.call(env)
      end
    end
1119649
function wrapGetOrSet(inherits, key, descriptor, gs, publicStatic) {
    if (hOP.call(descriptor, gs) && trustSuper(descriptor[gs])) {
      descriptor[gs] = wrap(
        gOPD(inherits, key),
        gs,
        descriptor[gs],
        publicStatic
      );
    }
  }
387157
def to_env
      rack_input = normalize_body(@request.body)

      env = HttpMonkey::Client::Environment.new(DEFAULT_ENV)
      env.uri = @request.url

      env.update({
        # request info
        'REQUEST_METHOD'  => @method.to_s.upcase,

        'rack.input'      => rack_input,
        'CONTENT_LENGTH'  => rack_input.length.to_s,

        # custom info
        'http_monkey.request' => [@method, @request, @client],
        'http_monkey.storage' => @client.storage
      })
      env.add_http_header(@request.headers)
      env
    end
919118
def create_rack(self):
        """"""
        return Rack(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
1310419
def adapt_files(solver):
    

    print("adapting {0}'s files".format(solver))
    root = os.path.join('solvers', solver)

    for arch in to_extract[solver]:
        arch = os.path.join(root, arch)
        extract_archive(arch, solver, put_inside=True)

    for fnames in to_move[solver]:
        old = os.path.join(root, fnames[0])
        new = os.path.join(root, fnames[1])
        os.rename(old, new)

    for f in to_remove[solver]:
        f = os.path.join(root, f)
        if os.path.isdir(f):
            shutil.rmtree(f)
        else:
            os.remove(f)
1033926
def setup(only: nil, except: nil)
      items = instance_methods.map(&:to_s) - %w[setup]
      items -= Array.wrap(except).map(&:to_s) if except
      if only
        only = Array.wrap(only).map(&:to_s)
        items &= only
        items += only
      end
      items.uniq.each { |item| public_send(item) }
    end
698373
function extend (to, _from) {
  for (const key in _from) {
    to[key] = _from[key];
  }
  return to
}
323579
def facetintervalrecordlookup(table, key, start='start', stop='stop',
                              include_stop=False):
    

    trees = facetrecordtrees(table, key, start=start, stop=stop)
    out = dict()
    for k in trees:
        out[k] = IntervalTreeLookup(trees[k], include_stop=include_stop)
    return out
887258
@Override public RackResponse call(RackEnvironment environment) {
    RubyHash environmentHash = convertToRubyHash(environment.entrySet());

    RubyArray response = callRackApplication(environmentHash);

    return convertToJavaRackResponse(response);
  }
80098
function mix (r, s, or, cl) {
  if (!s || !r) {
    return r;
  }

  var i = 0,
    c, len;

  or = or || arguments.length === 2;

  if (cl && (len = cl.length)) {
    for (; i < len; i++) {
      c = cl[i];
      if ((c in s) && (or || !(c in r))) {
        r[c] = s[c];
      }
    }
  } else {
    for (c in s) {
      if (or || !(c in r)) {
        r[c] = s[c];
      }
    }
  }
  return r;
}
248963
private HashMap<String, HashSet<Node>> getRackToHostsMapForStripe(
      String srcFileName,
      String parityFileName,
      int stripeLen,
      int parityLen,
      int stripeIndex) throws IOException {
    HashMap<String, HashSet<Node>> rackToHosts =
      new HashMap<String, HashSet<Node>>();
    if (srcFileName != null) {
      rackToHosts = getRackToHostsMapForStripe(srcFileName,
                                               stripeIndex,
                                               stripeLen);
    }
    if (parityFileName != null) {
      HashMap<String, HashSet<Node>> rackToHostsForParity =
        getRackToHostsMapForStripe(parityFileName,
                                   stripeIndex,
                                   parityLen);
      for (Map.Entry<String, HashSet<Node>> e :
           rackToHostsForParity.entrySet()) {
        HashSet<Node> nodes = rackToHosts.get(e.getKey());
        if (nodes == null) {
          nodes = new HashSet<Node>();
          rackToHosts.put(e.getKey(), nodes);
        }
        for (Node n : e.getValue()) {
          nodes.add(n);
        }
      }
    }
    for (Map.Entry<String, HashSet<Node>> e : rackToHosts.entrySet()) {
      if (e.getValue().size() > 1) {
        FSNamesystem.LOG.warn("F4: Rack " + e.getKey() +
          " being overused for stripe: " + stripeIndex);
      }
    }
    return rackToHosts;
  }
6663
function createStack(app, plugins) {
  if (app.enabled('minimal config')) {
    return es.pipe.apply(es, []);
  }
  function enabled(acc, plugin, name) {
    if (plugin == null) {
      acc.push(through.obj());
    }
    if (app.enabled(name + ' plugin')) {
      acc.push(plugin);
    }
    return acc;
  }
  var arr = _.reduce(plugins, enabled, []);
  return es.pipe.apply(es, arr);
}
397410
def schunk(string, size):
    """"""
    return [string[i:i+size] for i in range(0, len(string), size)]
1304308
def method_missing(name, *args, &block)
      if name.to_s[-1] == '='
        config[name[0..-2].to_s.upcase] = args[0]
      else
        config.fetch(name.to_s.upcase) {nil}
      end
    end