TODO all this code needs to die
347675
function processItems ( items, values, guid, counter ) {
  	if ( counter === void 0 ) counter = 0;

  	return items.map( function ( item ) {
  		if ( item.type === TEXT ) {
  			return item.template;
  		}

  		if ( item.fragment ) {
  			if ( item.fragment.iterations ) {
  				return item.fragment.iterations.map( function ( fragment ) {
  					return processItems( fragment.items, values, guid, counter );
  				}).join( '' );
  			} else {
  				return processItems( item.fragment.items, values, guid, counter );
  			}
  		}

  		var placeholderId = "" + guid + "-" + (counter++);
  		var model = item.model || item.newModel;

  		values[ placeholderId ] = model ?
  			model.wrapper ?
  				model.wrapper.value :
  				model.get() :
  			undefined;

  		return '${' + placeholderId + '}';
  	}).join( '' );
  }
912378
function complete() {
  quit();

  const deleteQueue = [];
  fs.readdir(paths.output, (err, files) => {
    if (files) {
      // lookup array for quick search inside existing component names
      const componentsLookup = components.map(item => {
        return slugify(item.meta.name);
      });

      // loop over files
      for (let i = 0, l = files.length; i < l; ++i) {
        const file = files[i];
        const ext = path.extname(file);

        // ignore dot files
        if (file.indexOf(".") === 0) {
          continue;
        }

        // if json+html file isn't inside lookup, mark for deletion
        if (componentsLookup.indexOf(path.basename(file, ext)) === -1) {
          deleteQueue.push(file);
        }
      }
    }

    // remove file by passing shorter queue
    function removeFile(q) {
      if (!q.length) {
        process.send(true);
        return;
      }

      const file = q.shift();
      rimraf(path.resolve(paths.output, file), { read: false }, () => {
        removeFile(q);
      });
    }

    removeFile(deleteQueue);
  });
}
1073485
function() {
			_.each(window.app.Todos.completed(), function(todo){ todo.destroy(); });
			return false;
		}
528821
protected function purgeOldCodesFromDatabase()
    {
        if ($this->use_database && $this->pdo_conn) {
            $now   = time();
            $limit = (!is_numeric($this->expiry_time) || $this->expiry_time < 1) ? 86400 : $this->expiry_time;

            $query = sprintf("DELETE FROM %s WHERE %s - created > %s",
                             $this->database_table,
                             $now,
                             $this->pdo_conn->quote("$limit", PDO::PARAM_INT));

            $result = $this->pdo_conn->query($query);
        }
    }
900479
function deleteCodeComments(code) {
    // 另一种思路更简便的办法
    // 将'://'全部替换为特殊字符，删除注释代码后再将其恢复回来
    var tmp1 = ':\/\/';
    var regTmp1 = /:\/\//g;
    var tmp2 = '@:@/@/@';
    var regTmp2 = /@:@\/@\/@/g;
    code = code.replace(regTmp1, tmp2);
    code = code.replace(rComments, '');
    return code.replace(regTmp2, tmp1);
}
630081
function ( code ) {
		var text = code.firstChild;
		if ( text ) {
			text.data = text.data.substring ( 1 ); // we inserted a #
		}
	}
382204
def kill(self, dwExitCode = 0):
        
        hThread = self.get_handle(win32.THREAD_TERMINATE)
        win32.TerminateThread(hThread, dwExitCode)

        # Ugliest hack ever, won't work if many pieces of code are injected.
        # Seriously, what was I thinking? Lame! :(
        if self.pInjectedMemory is not None:
            try:
                self.get_process().free(self.pInjectedMemory)
                self.pInjectedMemory = None
            except Exception:
##                raise           # XXX DEBUG
                pass
1016369
function highlight(code) {
  return new Promise((resolve, reject) => {
    pygmentize({ lang: 'html', format: 'html' }, code, function (err, result) {
      if (err) {
        console.log(err);
        reject(err);
      } else {
        resolve(result.toString());
      };
    });
  });
}
338532
function writeAndRunCodeBlocks(codeBlocks) {
  var dir = '.runnable-markdown-' + rand.generateKey(7);
  return makeTempDir(dir)
  .then(function() {
    return new Promise(function(fulfill, reject) {
      async.mapSeries(codeBlocks, function(codeBlock, callback) {
        appendCodeBlockToFile(codeBlock, dir)
          .then(runCodeBlock)
          .then(function(codeBlock) {
            callback(null, codeBlock);
          })
          .catch(function(err) {
            callback(err, null);
          });
      }, convertAsyncResultToPromise(fulfill, reject));
    });
  })
  .then(function(codeBlocks) {
    return removeOldDir(dir)
      .then(function() {
        return codeBlocks;
      });
  });
}
1260787
def close(self, code: int = None, reason: str = None) -> None:
        """"""
        if not self.server_terminated:
            if not self.stream.closed():
                if code is None and reason is not None:
                    code = 1000  # "normal closure" status code
                if code is None:
                    close_data = b""
                else:
                    close_data = struct.pack(">H", code)
                if reason is not None:
                    close_data += utf8(reason)
                try:
                    self._write_frame(True, 0x8, close_data)
                except StreamClosedError:
                    self._abort()
            self.server_terminated = True
        if self.client_terminated:
            if self._waiting is not None:
                self.stream.io_loop.remove_timeout(self._waiting)
                self._waiting = None
            self.stream.close()
        elif self._waiting is None:
            # Give the client a few seconds to complete a clean shutdown,
            # otherwise just close the connection.
            self._waiting = self.stream.io_loop.add_timeout(
                self.stream.io_loop.time() + 5, self._abort
            )
928396
function immediateExit(exitCode) {
    electron.removeListener('exit', immediateExit);
    electron.removeListener('error', immediateError);

    callback(new NavitError(`Electron immediately exited with: ${exitCode}`));
  }
343489
function compile(code, options) {
        var output;
        options = options || {};
        options.requireModule = options.requireModule || requireModule;
        var ast = parse(code, options.modules || [], options);
        if (options.readableNames) {
            ast = optimizeHygiene(ast);
        }
        if (options.ast) {
            return ast;
        }
        if (options.sourceMap) {
            output = codegen.generate(ast, _.extend({
                comment: true,
                sourceMap: options.filename,
                sourceMapWithCode: true
            }, options.escodegen));
            return {
                code: output.code,
                sourceMap: output.map.toString()
            };
        }
        return { code: codegen.generate(ast, _.extend({ comment: true }, options.escodegen)) };
    }
1193361
function exit()
{
	if (my_MotorDriver_obj)
	{
		my_MotorDriver_obj = null;
		MotorDriver_lib.cleanUp();
	}
	MotorDriver_lib = null;
	console.log("Exiting");
	process.exit(0);	
}
1098707
function() {
        // Destroy console
        if(this._elConsole) {
            // Unhook DOM events
            Event.purgeElement(this._elConsole, true);

            // Remove DOM elements
            this._elConsole.innerHTML = "";
        }

        // Ceate console
        this._elConsole = make("div", { className: "yui-log-bd" });

        // If implementer has provided console, trust and set those
        if(this.height) {
            this._elConsole.style.height = this.height;
        }

        this._elContainer.appendChild(this._elConsole);
    }
1280089
function (mode, code, tokens, flags, scope, parseMode) {
    var index = code.index,
        length = code.length;

    if ( /* <!-- */
        code.codePointAt(index) === 0x003c &&
        code.codePointAt(++index) === 0x0021 &&
        code.codePointAt(++index) === 0x002d &&
        code.codePointAt(++index) === 0x002d
    ) {
        index++;

        for (; index < length; index++) {
            if ( /* --> */
                code.codePointAt(index) === 0x002d &&
                code.codePointAt(index + 1) === 0x002d &&
                code.codePointAt(index + 2) === 0x003e
            ) {
                index += 3;
                code.index = index;

                return true;
            }
        }

        throw code.makeError(
            code.index, code.index + 4,
            'Unclosed Comment: Expected "-->" to fallow "<!--".'
        );
    }

    return null;
}
985161
def finish(self, exitcode):
        
        self._queue.put(self.Finish(exitcode))
        self._thread.join()
939419
def delete_opcode(opcode)
      @chunks = @chunks.inject([]) do |list, chunk|
        list << chunk if chunk.opcode != opcode
        list
      end
      return self
    end