Runs a snippet of JavaScript via script injection.

@private
@param {String} code The code to run.
181402
function runScript(code) {
    var anchor = freeDefine ? define.amd : Benchmark,
        script = doc.createElement('script'),
        sibling = doc.getElementsByTagName('script')[0],
        parent = sibling.parentNode,
        prop = uid + 'runScript',
        prefix = '(' + (freeDefine ? 'define.amd.' : 'Benchmark.') + prop + '||function(){})();';

    // Firefox 2.0.0.2 cannot use script injection as intended because it executes
    // asynchronously, but that's OK because script injection is only used to avoid
    // the previously commented JaegerMonkey bug.
    try {
      // remove the inserted script *before* running the code to avoid differences
      // in the expected script element count/order of the document.
      script.appendChild(doc.createTextNode(prefix + code));
      anchor[prop] = function() { destroyElement(script); };
    } catch(e) {
      parent = parent.cloneNode(false);
      sibling = null;
      script.text = code;
    }
    parent.insertBefore(script, sibling);
    delete anchor[prop];
  }
624178
function( HTMLCode ){
        var $ = cheerio.load( HTMLCode, { decodeEntities: false } );

        _.forEach(
            {
                a: "href",
                img: "src",
                link: "href",
                script: "src"
            },
            function( attr, tagName ){
                $( tagName + "[" + attr + "]" ).each( function( index, elm ){
                    var testValue = $( elm ).attr( attr );
                    if( testValue.match( /^(#|\/|http:\/\/|https:\/\/|tel:|mailto:)/ ) ){ return; }
                    $( elm ).attr( attr, "<%- __normalizePath__( \"" + this.convertResourcePathAbsolute( testValue ).replace( /\\/g, "\\\\" ) + "\" ) %>" );
                }.bind( this ) );
            },
            this
        );

        return $.html();
    }
220462
@Override
	public Object executeJavaScript(String code) throws CrawljaxException {
		try {
			JavascriptExecutor js = (JavascriptExecutor) browser;
			return js.executeScript(code);
		} catch (WebDriverException e) {
			throwIfConnectionException(e);
			throw new CrawljaxException(e);
		}
	}
560185
function execute(req, res) {
  ScriptManager.eval(req, res, '' + req.args[0], req.args.slice(1));
}
982016
function parseScript(code, parserOptions) {
    const parser =
        parserOptions.parser === "espree" || !parserOptions.parser
            ? require("espree") // eslint-disable-line @mysticatea/node/no-extraneous-require
            : require(parserOptions.parser)
    const scriptParserOptions = Object.assign({}, parserOptions)
    delete scriptParserOptions.parser
    const result =
        typeof parser.parseForESLint === "function"
            ? parser.parseForESLint(code, scriptParserOptions)
            : parser.parse(code, scriptParserOptions)
    if (result.ast) {
        return result
    }
    return {
        ast: result,
    }
}
155833
function injectCode(code, id) {
  var pre = document.getElementById(id);
  pre.textContent = code;
  code = pre.innerHTML;
  code = prettyPrintOne(code, 'js');
  pre.innerHTML = code;
}
185012
def run(self, *args):
        """"""

        params = self.parser.parse_args(args)
        sources = params.source
        code = self.autocomplete(sources)

        return code
1313952
function compile(code, closure) {
  code = providePlugins(isolateScope(code, closure)).join('\n');
  try {
    return vm.runInThisContext('(' + code + ')').apply({}, values(plugins));
  } catch (err) {
    throw new Meteor.Error(400, err);
  }
}
1005213
function mockKeyDown(code) {
        var event = mockEventOnDefaultEditableCells('keydown');
        event.keyCode = event.which = code;
        return event;
    }
1186682
function(code){
    // Wrap code blocks with {}.
    // we only wrap unbuffered code blocks ATM
    // since they are usually flow control

    // Buffer code
    if (code.buffer) {
      var val = code.val.trim();
      val = 'null == (pug_interp = '+val+') ? "" : pug_interp';
      if (code.mustEscape !== false) val = this.runtime('escape') + '(' + val + ')';
      this.bufferExpression(val);
    } else {
      this.buf.push(code.val);
    }

    // Block support
    if (code.block) {
      if (!code.buffer) this.buf.push('{');
      this.visit(code.block, code);
      if (!code.buffer) this.buf.push('}');
    }
  }
1245100
function run(transformFn, script) {
  const scriptEl = document.createElement('script');
  scriptEl.text = transformCode(transformFn, script);
  headEl.appendChild(scriptEl);
}
906833
function tryToCoverWindow(code) {

        if (typeof window === "object") {

            var variables = Object.getOwnPropertyNames(window);

            if (!window.hasOwnProperty('window')) {

                variables.push('window');

            }

            var stubDeclarations = '';
            variables.forEach(function(name) {

                // If the name really can be the name of variable.
                if (lodash.isString(name)) {

                    var stub = 'var ' + name + '; \n';

                    stubDeclarations = stubDeclarations + stub;

                }

            });

            code = stubDeclarations + code;

        }

        return code;

    }
1022475
function execute(code, { filename = path.cwd('./__temp.js'), babelOptions } = {}) {

    // 生成模块
    if (!(filename in locals) || locals.code !== code) {
        let script = new vm.Script(transform(code, babelOptions).code, { filename }),
            dirname = path.dirname(filename),
            loader = createLoader(dirname, babelOptions),
            local = { exports: {} };

        // 执行代码
        script.runInNewContext({
            process,
            module: local,
            exports: local.exports,
            require: loader,
            __dirname: dirname,
            __filename: filename
        });

        // 缓存模块
        locals[filename] = { code, exports: local.exports };
    }

    // 返回模块
    return locals[filename].exports;
}
983437
def run(self, code: str) -> Output:
        
        output = self._execute(code)
        if self.echo and output.text:
            print(output.text)
        if self.check:
            output.raise_for_status()
        return output
83416
public static void exec(String code){

        code = getFunctionalCode("__f_" + Thread.currentThread().getId(), code);
        acquireGIL();
        log.info("CPython: PyRun_SimpleStringFlag()");
        log.info(code);
        int result = PyRun_SimpleStringFlags(code, null);
        if (result != 0){
            PyErr_Print();
            throw new RuntimeException("exec failed");
        }
        log.info("Exec done");
        releaseGIL();
    }
180522
function injectScript() {

    // Creating script element
    var script = document.createElement('script'),
        body = document.getElementsByTagName('body')[0];

    script.src = chrome.extension.getURL('build/artoo.chrome.js');
    script.type = 'text/javascript';
    script.id = 'artoo_injected_script';
    script.setAttribute('chrome', 'true');

    // Appending to body
    body.appendChild(script);
  }
121653
function globalEval(code) {
        var script;

        code = code.replace(/^\s+/, '').replace(/\s+$/, '');

        if (code) {
            if (code.indexOf('use strict') === 1) {
                script = document.createElement('script');
                script.text = code;
                head.appendChild(script).parentNode.removeChild(script);
            }
            else {
                eval(code);
            }
        }
    }