HACK: hacky implementation right here right now
163450
def mod_codes
      return @mod_codes if @mod_codes

      @mod_codes = []
      snapshots.each do |s|
        s.content.each.each do |i|
          i.mod_codes.each do |mod_code|
            @mod_codes << {:mod_code => mod_code, :name => i.name}
          end
        end
      end

      return @mod_codes
    end
70208
private static List<URL> hackForWeblogic(FilterConfig config) {
        List<URL> urls = new ArrayList<>();
        Set libJars = config.getServletContext().getResourcePaths("/WEB-INF/lib");
        for (Object jar : libJars) {
            try {
                urls.add(config.getServletContext().getResource((String) jar));
            }
            catch (MalformedURLException e) {
                LOGGER.warn("Failed to get resource: " + jar);
            }
        }
        addClassesUrl(config, urls);
        return urls;
    }
47314
function blockEncrypt(input, inOffset, sessionKey) {

        if (input &&
          sessionKey &&
          utils.isAnArray(sessionKey) &&
          utils.isAnArray(input)) {

          input = new Uint8Array(input);
          var sBox = sessionKey[0]
            , sKey = sessionKey[1]

            /*eslint-disable no-plusplus*/
            , x0 = input[inOffset++] & 0xFF |
                   (input[inOffset++] & 0xFF) << 8 |
                   (input[inOffset++] & 0xFF) << 16 |
                   (input[inOffset++] & 0xFF) << 24

            , x1 = input[inOffset++] & 0xFF |
                   (input[inOffset++] & 0xFF) << 8 |
                   (input[inOffset++] & 0xFF) << 16 |
                   (input[inOffset++] & 0xFF) << 24

            , x2 = input[inOffset++] & 0xFF |
                   (input[inOffset++] & 0xFF) << 8 |
                   (input[inOffset++] & 0xFF) << 16 |
                   (input[inOffset++] & 0xFF) << 24

            , x3 = input[inOffset++] & 0xFF |
                   (input[inOffset++] & 0xFF) << 8 |
                   (input[inOffset++] & 0xFF) << 16 |
                   (input[inOffset++] & 0xFF) << 24
            /*eslint-enable no-plusplus*/

            , t0
            , t1
            , k = ROUND_SUBKEYS
            , R = 0;

          x0 ^= sKey[INPUT_WHITEN];
          x1 ^= sKey[INPUT_WHITEN + 1];
          x2 ^= sKey[INPUT_WHITEN + 2];
          x3 ^= sKey[INPUT_WHITEN + 3];
          for (R = 0; R < ROUNDS; R += 2) {

            t0 = fe32(sBox, x0, 0);
            t1 = fe32(sBox, x1, 3);
            /*eslint-disable no-plusplus*/
            x2 ^= t0 + t1 + sKey[k++];
            /*eslint-enable no-plusplus*/
            x2 = x2 >>> 1 | x2 << 31;
            x3 = x3 << 1 | x3 >>> 31;
            /*eslint-disable no-plusplus*/
            x3 ^= t0 + 2 * t1 + sKey[k++];
            /*eslint-enable no-plusplus*/

            t0 = fe32(sBox, x2, 0);
            t1 = fe32(sBox, x3, 3);
            /*eslint-disable no-plusplus*/
            x0 ^= t0 + t1 + sKey[k++];
            /*eslint-enable no-plusplus*/
            x0 = x0 >>> 1 | x0 << 31;
            x1 = x1 << 1 | x1 >>> 31;
            /*eslint-disable no-plusplus*/
            x1 ^= t0 + 2 * t1 + sKey[k++];
            /*eslint-enable no-plusplus*/
          }

          x2 ^= sKey[OUTPUT_WHITEN];
          x3 ^= sKey[OUTPUT_WHITEN + 1];
          x0 ^= sKey[OUTPUT_WHITEN + 2];
          x1 ^= sKey[OUTPUT_WHITEN + 3];

          return new Uint8Array([x2, x2 >>> 8, x2 >>> 16, x2 >>> 24,
             x3, x3 >>> 8, x3 >>> 16, x3 >>> 24,
             x0, x0 >>> 8, x0 >>> 16, x0 >>> 24,
             x1, x1 >>> 8, x1 >>> 16, x1 >>> 24]);
        }

        throw 'input block is not an array or sessionKey is incorrect';
      }
464962
def dump(esp, _efuses, args):
    
    for block in range(len(EFUSE_BLOCK_OFFS)):
        print("EFUSE block %d:" % block)
        offsets = [x + EFUSE_BLOCK_OFFS[block] for x in range(EFUSE_BLOCK_LEN[block])]
        print(" ".join(["%08x" % esp.read_efuse(offs) for offs in offsets]))
1250926
function(str) {
            var root, error = null;

            i = j = current = 0;
            chunks = [];
            input = str.replace(/\r\n/g, '\n');
            if (env.filename) {
                that.env.inputs[env.filename] = input;
            }

            // Split the input into chunks.
            chunks = (function (chunks) {
                var j = 0,
                    skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
                    comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
                    string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
                    level = 0,
                    match,
                    chunk = chunks[0],
                    inParam;

                for (var i = 0, c, cc; i < input.length;) {
                    skip.lastIndex = i;
                    match = skip.exec(input);
                    if (match) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                        }
                    }
                    c = input.charAt(i);
                    comment.lastIndex = string.lastIndex = i;

                    match = string.exec(input)
                    if (match) {
                        if (match.index === i) {
                            i += match[0].length;
                            chunk.push(match[0]);
                            continue;
                        }
                    }

                    if (!inParam && c === '/') {
                        cc = input.charAt(i + 1);
                        if (cc === '/' || cc === '*') {
                            match = comment.exec(input);
                            if (match) {
                                if (match.index === i) {
                                    i += match[0].length;
                                    chunk.push(match[0]);
                                    continue;
                                }
                            }
                        }
                    }

                    switch (c) {
                        case '{':
                            if (!inParam) {
                                level ++;
                            }
                            else {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        case '}':
                            if (!inParam) {
                                level --;
                                chunk.push(c);
                                chunks[++j] = chunk = [];
                            }
                            else {
                                inParam = false;
                                chunk.push(c);
                            }
                            break;
                        case '(':
                            if (!inParam) {
                                inParam = true;
                            }
                            else {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        case ')':
                            if (inParam) {
                                inParam = false;
                            }
                            chunk.push(c);
                            break;
                        default:
                            chunk.push(c);
                    }

                    i++;
                }
                if (level !== 0) {
                    error = {
                        index: i - 1,
                        message: (level > 0) ? "missing closing `}`" : "missing opening `{`",
                        filename: env.filename
                    };
                }

                return chunks.map(function (c) { return c.join(''); });
            })([[]]);

            if (error) {
                util.error(env, error);
                throw new Error('N/A');
            }

            // Start with the primary rule.
            // The whole syntax tree is held under a Ruleset node,
            // with the `root` property set to true, so no `{}` are
            // output.
            root = new tree.Ruleset([], $(this.parsers.primary));
            root.root = true;

            // Get an array of Ruleset objects, flattened
            // and sorted according to specificitySort
            root.toList = (function() {
                return function(env) {
                    env.frames = env.frames || [];


                    // call populates Invalid-caused errors
                    var definitions = this.flatten([], [], env);
                    definitions.sort(specificitySort);
                    return definitions;
                };
            })();

            // Sort rules by specificity: this function expects selectors to be
            // split already.
            //
            // Written to be used as a .sort(Function);
            // argument.
            //
            // [1, 0, 0, 467] > [0, 0, 1, 520]
            var specificitySort = function(a, b) {
                var as = a.specificity;
                var bs = b.specificity;

                if (as[0] != bs[0]) return bs[0] - as[0];
                if (as[1] != bs[1]) return bs[1] - as[1];
                if (as[2] != bs[2]) return bs[2] - as[2];
                return bs[3] - as[3];
            };

            return root;
        }
1346515
function done(code) {
		// calculate shasum and cache info
		var shasum = crypto.createHash('sha1');
		shasum.update(code);
		self._shasums[scriptName] = shasum.digest('hex');
		self._scripts[scriptName] = code;
		self._files[fileName] = code;

		// make dublicate entries for both script and script.lua
		if (path.extname(scriptName) === ext) {
			var alt = scriptName.substr(0, scriptName.length - ext.length);
			self._shasums[alt] = self._shasums[scriptName]
			self._scripts[alt] = self._scripts[scriptName]
			self._keys[alt] = self._keys[scriptName]
		}

		delete self._resolving[fileName];
		callback(null, code);
	}
257702
function({_t0, arg, keys, inv}) {
		const key = keys && makeKey(opts, keys);
		const lay = layers.map(l => l.instantiate({key, ttl, ttr, inv}));
		const fix = lay.slice();
		const ret = Q.defer();
		const bld = () => {
			const _t1 = new Date;
			return Q()
				.then(() => func.apply(this, arg))
				.then(val => {
					time('build', new Date - _t1);
					return val;
				});
		}

		const set = (layer, val) => {
			if (shouldCache(val)) {
				layer.set(val);
			}
		}

		const pump = () => {

			// Get the next layer.
			const cur = lay.shift();
			const _t1 = new Date;

			// If we couldn't make a key, then we force a miss.
			// If we're out of layers, then we'll just have to
			// build.  It's a full miss.
			// We can _force_ a miss with the `_bust` parameter.
			if (!key || !cur || force()) {
				bld().then(val => {

					// Hand it off.
					ret.resolve(val)

					// Sob about it.
					time('miss', new Date - _t0);

				// Patch rejection through to return promise.
				}).catch(err => ret.reject(err));
				return;
			}

			Q().then(() => cur.get()).then(() => {

				// If we found a value and it's not expired.
				if (cur.val && !cur.exp) {

					// Hand it off.
					ret.resolve(cur.val);

					// Brag about it.
					time('hit', new Date - _t0);
					time(`layer.${cur.name()}.hit.fromStart`,  new Date - _t0);
					time(`layer.${cur.name()}.hit.individual`, new Date - _t1);

					// If our time-to-rebuild has elapsed,
					// we'll rebuild in the background and
					// populate the new value into all
					// layers.
					if (cur.red) {
						bld().then((val) => {
							fix.forEach(layer => set(layer, val));
						}).catch(() => {
							time('error.background', new Date - _t0);
						});

					}
				} else {

					// Miss.  Populate this layer later
					// when we get a value.
					ret.promise.then(val => set(cur, val));

					time(`layer.${cur.name()}.miss.fromStart`,  new Date - _t0);
					time(`layer.${cur.name()}.miss.individual`, new Date - _t1);

					// Try the next layer.
					pump();
				}
			});
		}

		if (inv) {
			// Invalidate.
			Q.all(fix.map(l => l.set())).then(ret.resolve);
		} else {
			// Start looking!
			pump();
		}

		// Log if we reject.
		ret.promise.catch(() => time('error.returned', new Date - _t0));

		// We'll find it, we promise!
		return ret.promise

			// Post-processing on the way out of the cache.
			.then(after)

			// Down and to the right!
			.then(v => (time('overall', new Date - _t0), v))
	}
1213430
function _dochecks()
	{
		// Check for locale-related bug
		if (1.1 == 1) {
			throw new \Mpdf\MpdfException('Do not alter the locale before including mPDF');
		}

		// Check for decimal separator
		if (sprintf('%.1f', 1.0) != '1.0') {
			setlocale(LC_NUMERIC, 'C');
		}

		if (ini_get('mbstring.func_overload')) {
			throw new \Mpdf\MpdfException('Mpdf cannot function properly with mbstring.func_overload enabled');
		}

		if (!function_exists('mb_substr')) {
			throw new \Mpdf\MpdfException('mbstring extension must be loaded in order to run mPDF');
		}
	}
693777
def main():
    
    # Try parsing command line args and flags with docopt
    args = docopt(__doc__, version="cdk")
    # Am I going to need validation? No Schema for the moment...
    if args['FILE']:
        out = output_file(args['FILE'])
        # Great! Run asciidoc with appropriate flags
        theme = pick_theme(args['--theme'])
        if theme not in listdir(THEMES_DIR):
            exit('Selected theme "%s" not found. Check ~/.cdk/prefs' % theme)
        cmd = create_command(theme, args['--bare'], args['--toc'], args['--notransition'],
                             args['--logo'])
        run_command(cmd, args)
        if args['--toc']:
            add_css(out, '.deck-container .deck-toc li a span{color: #888;display:inline;}')
        if args['--custom-css']:
            add_css_file(out, args['--custom-css'])
        if args['--open']:
            webbrowser.open("file://" + abspath(out))

    # other commands
    elif args['--generate']:
        if isfile(args['--generate']):
            exit("%s already exists!" % args['--generate'])
        with open(args['--generate'], "w") as fp:
            sample = join(LOCATION,  "custom", "sample.asc")
            fp.write(open(sample).read())
            print("Created sample slide deck in %s..." % args['--generate'])
        exit()

    elif args['--install-theme']:
        path = args['--install-theme']
        if not isfile(path):
            exit("Theme file not found.")
        if not path.endswith(".zip"):
            exit("Theme installation currently only supports theme install from "
                 ".zip files.")
        install_theme(path)
    elif args['--default-theme']:
        set_default_theme(args['--default-theme'])
862707
def dump_all_keys_or_addrs(wallet_obj):
    '''
    
    '''

    print_traversal_warning()

    puts('\nDo you understand this warning?')
    if not confirm(user_prompt=DEFAULT_PROMPT, default=False):
        puts(colored.red('Dump Cancelled!'))
        return

    mpub = wallet_obj.serialize_b58(private=False)

    if wallet_obj.private_key:
        desc_str = 'private keys'
    else:
        desc_str = 'addresses'
        puts('Displaying Public Addresses Only')
        puts('For Private Keys, please open bcwallet with your Master Private Key:\n')
        priv_to_display = '%s123...' % first4mprv_from_mpub(mpub=mpub)
        print_bcwallet_basic_priv_opening(priv_to_display=priv_to_display)

    puts('How many %s (on each chain) do you want to dump?' % desc_str)
    puts('Enter "b" to go back.\n')

    num_keys = get_int(
            user_prompt=DEFAULT_PROMPT,
            max_int=10**5,
            default_input='5',
            show_default=True,
            quit_ok=True,
            )

    if num_keys is False:
        return

    if wallet_obj.private_key:
        print_childprivkey_warning()

    puts('-' * 70)
    for chain_int in (0, 1):
        for current in range(0, num_keys):
            path = "m/%d/%d" % (chain_int, current)
            if current == 0:
                if chain_int == 0:
                    print_external_chain()
                    print_key_path_header()
                elif chain_int == 1:
                    print_internal_chain()
                    print_key_path_header()
            child_wallet = wallet_obj.get_child_for_path(path)
            if wallet_obj.private_key:
                wif_to_use = child_wallet.export_to_wif()
            else:
                wif_to_use = None
            print_path_info(
                    address=child_wallet.to_address(),
                    path=path,
                    wif=wif_to_use,
                    coin_symbol=coin_symbol_from_mkey(mpub),
                    )

    puts(colored.blue('\nYou can compare this output to bip32.org'))
1034936
def cli(ctx, verbose, fake, install, uninstall, config):
    """"""
    # Create a repo object and remember it as as the context object.  From
    # this point onwards other commands can refer to it by using the
    # @pass_scm decorator.
    ctx.obj = SCMRepo()
    ctx.obj.fake = fake
    ctx.obj.verbose = fake or verbose

    if install:
        do_install(ctx, verbose, fake)
        ctx.exit()
    elif uninstall:
        do_uninstall(ctx, verbose, fake)
        ctx.exit()
    elif config:
        do_edit_settings(fake)
        ctx.exit()
    else:
        if ctx.invoked_subcommand is None:
            # Display help to user if no commands were passed.
            click.echo(format_help(ctx.get_help()))
482028
function actuallyInstallHook(
			hookToCopy,
			whereToPutIt,
			sourceCanonicalName
		) {
			mkpath.sync( path.join( './', path.dirname( whereToPutIt ) ) );
			exec( 'cp ' + hookToCopy + ' ' + whereToPutIt );
			grunt.log.writeln( [
				'Installed ', sourceCanonicalName, ' hook in ', whereToPutIt
			].join( '' ).green );
		}
655293
function executeHooks(data, allHooks, checkHooks, creationMode) {
    var hooksToCall = creationMode ? allHooks : checkHooks;
    if (hooksToCall) {
        callHooks(data, hooksToCall);
    }
}
475470
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters,
                     $placement )
    {
        if ( $operatorName == $this->LocaleFetchName )
        {
            if ( $operatorValue !== null )
            {
                $localeString = $operatorValue;
            }
            else
            {
                if ( count( $operatorParameters ) < 1 )
                {
                    $tpl->missingParameter( $operatorName, 'localestring' );
                    return;
                }
                $localeString = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement, true );
            }
            $locale = eZLocale::instance( $localeString );
            $operatorValue = $locale;
            return;
        }
        $locale = eZLocale::instance();
        if ( $operatorName == $this->GetTimeName )
        {
            $timestamp = $operatorValue;
            if ( $timestamp === null )
                $timestamp = $namedParameters['timestamp'];

            if ( !$timestamp )
                $timestamp = time();

            $info = getdate( $timestamp );
            $week = date( 'W', $timestamp );
            if ( $info['wday'] == 0 )
                ++$week;
            $operatorValue = array( 'seconds' => $info['seconds'],
                                    'minutes' => $info['minutes'],
                                    'hours' => $info['hours'],
                                    'day' => $info['mday'],
                                    'month' => $info['mon'],
                                    'year' => $info['year'],
                                    'weeknumber' => $week,
                                    'weekday' => $info['wday'],
                                    'yearday' => $info['yday'],
                                    'epoch' => $info[0] );
        }
        else if ( $operatorName == $this->MakeTimeName )
        {
            $parameters = array();
            if ( $namedParameters['hour'] !== false )
                $parameters[] = $namedParameters['hour'];
            if ( $namedParameters['minute'] !== false )
                $parameters[] = $namedParameters['minute'];
            if ( $namedParameters['second'] !== false )
                $parameters[] = $namedParameters['second'];
            if ( $namedParameters['month'] !== false )
                $parameters[] = $namedParameters['month'];
            {
                if ( $namedParameters['day'] !== false )
                    $parameters[] = $namedParameters['day'];
                {
                    if ( $namedParameters['year'] !== false )
                        $parameters[] = $namedParameters['year'];
                    {
                        if ( $namedParameters['dst'] !== false )
                            $parameters[] = $namedParameters['dst'];
                    }
                }
            }

            $operatorValue = count( $parameters ) == 0 ? time() : call_user_func_array( 'mktime', $parameters );
        }
        else if ( $operatorName == $this->MakeDateName )
        {
            $parameters = array( 0, 0, 0 );
            if ( $namedParameters['month'] !== false )
                $parameters[] = $namedParameters['month'];
            {
                if ( $namedParameters['day'] !== false )
                    $parameters[] = $namedParameters['day'];
                {
                    if ( $namedParameters['year'] !== false )
                        $parameters[] = $namedParameters['year'];
                    {
                        if ( $namedParameters['dst'] !== false )
                            $parameters[] = $namedParameters['dst'];
                    }
                }
            }
            $operatorValue = call_user_func_array( 'mktime', $parameters );
        }
        else if ( $operatorName == $this->CurrentDateName )
        {
            $operatorValue = time();
        }
        else if ( $operatorName == $this->DateTimeName )
        {
            $class = $namedParameters['class'];
            if ( $class === null )
                return;
            if ( $class == 'custom' )
            {
                $operatorValue = $locale->formatDateTimeType( $namedParameters['data'], $operatorValue );
            }
            else
            {
                $dtINI = eZINI::instance( 'datetime.ini' );
                $formats = $dtINI->variable( 'ClassSettings', 'Formats' );
                if ( array_key_exists( $class, $formats ) )
                {
                    $classFormat = $formats[$class];
                    $operatorValue = $locale->formatDateTimeType( $classFormat, $operatorValue );
                }
                else
                    $tpl->error( $operatorName, "DateTime class '$class' is not defined", $placement );
            }
        }
        else if ( $operatorName == $this->LocaleName )
        {
            $type = $namedParameters['type'];
            if ( $type === null )
                return;

            $localeString = $namedParameters['locale'];
            $param = $namedParameters['param'];

            // change locale if need
            if ( $localeString )
                $locale = eZLocale::instance( $localeString );

            $method = $locale->getFormattingFunction( $type );
            if ( $method )
            {
                switch ( $type )
                {
                    case 'currency':
                        {
                            if ( $param === false )
                                $param = $locale->attribute( 'currency_symbol' );

                            $operatorValue = $locale->$method( $operatorValue, $param );
                        } break;

                    default:
                        {
                            $operatorValue = $locale->$method( $operatorValue );
                        } break;
                }
            }
            else
            {
                $tpl->error( $operatorName, "Unknown locale type: '$type'", $placement );
            }
        }
    }
562245
def _at_dump_mixins(self, calculator, rule, scope, block):
        
        sys.stderr.write("%s\n" % repr(rule.namespace._mixins))
858864
function()
	{
		if (typeof console !== 'undefined' && ((pwf.has('module', 'config') && pwf.config.get('debug.frontend')) || !pwf.has('module', 'config'))) {
			var args = pwf.clone_array(arguments);

			if (args.length > 1) {
				console.log(args);
			} else {
				console.log(args[0]);
			}
		}
	}
657888
function conventionalGitlabReleaser (auth, changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts, userCb) {
  if (!auth) {
    throw new Error('Expected an auth object')
  }

  const promises = []

  const changelogArgs = [changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts].map(function (arg) {
    if (typeof arg === 'function') {
      userCb = arg
      return {}
    }
    return arg || {}
  })

  if (!userCb) {
    throw new Error('Expected an callback')
  }

  changelogOpts = changelogArgs[0]
  context = changelogArgs[1]
  gitRawCommitsOpts = changelogArgs[2]
  parserOpts = changelogArgs[3]
  writerOpts = changelogArgs[4]

  changelogOpts = merge({
    transform: transform,
    releaseCount: 1
  }, changelogOpts)

  writerOpts.includeDetails = true

  // ignore the default header partial
  writerOpts.headerPartial = writerOpts.headerPartial || ''

  Q.nfcall(gitSemverTags)
    .then(function (tags) {
      if (!tags || !tags.length) {
        setImmediate(userCb, new Error('No semver tags found'))
        return
      }

      const releaseCount = changelogOpts.releaseCount
      if (releaseCount !== 0) {
        gitRawCommitsOpts = assign({
          from: tags[releaseCount]
        }, gitRawCommitsOpts)
      }

      gitRawCommitsOpts.to = gitRawCommitsOpts.to || tags[0]

      conventionalChangelog(changelogOpts, context, gitRawCommitsOpts, parserOpts, writerOpts)
        .on('error', function (err) {
          userCb(err)
        })
        .pipe(through.obj(function (chunk, enc, cb) {
          if (!chunk.keyCommit || !chunk.keyCommit.version) {
            cb()
            return
          }

          const url = `projects/${escape(context.owner + `/` + context.repository)}/repository/tags`
          const options = {
            endpoint: auth.url,
            body: {
              tag_name: chunk.keyCommit.version,
              ref: chunk.keyCommit.hash,
              message: 'Release ' + chunk.keyCommit.version,
              release_description: chunk.log
            }
          }
          debug(`posting %o to the following URL - ${url}`, options)

          // Set auth after debug output so that we don't print auth token to console.
          options.token = auth.token

          promises.push(glGot(url, options))

          cb()
        }, function () {
          Q.all(promises)
            .then(function (responses) {
              userCb(null, responses)
            })
            .catch(function (err) {
              userCb(err)
            })
        }))
    })
    .catch(function (err) {
      userCb(err)
    })
}