/* ========================================================================== *
CONSTRUCTOR & INITIALIZATION                                              *
==========================================================================
174705
function Sink(callback) {

  _.bindAll(this);

  this._dataPackets = [];

  this.writable = true;
  this.callback = callback;

  this.on('err', this._onError);

  Stream.apply(this);
}
940565
public function init()
    {
        parent::init();
        if (isset($this->attrs->version)) {
            $this->version = $this->attrs->version;
        }
        $this->header('Cache-Control: max-age=31536000, public, pre-check=0, post-check=0');
        $this->header('Expires: ' . date('r', strtotime('+1 year')));
        $html = '<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<script>
		document.domain = document.domain;
		_sockjs_onload = function(){SockJS.bootstrap_iframe();};
	</script>
	<script src="https://cdn.jsdelivr.net/sockjs/' . htmlentities($this->version, ENT_QUOTES, 'UTF-8') . '/sockjs.min.js"></script>
</head>
<body>
	<h2>Don\'t panic!</h2>
	<p>This is a SockJS hidden iframe. It\'s used for cross domain magic.</p>
</body>
</html>';
        $etag = 'W/"' . sha1($html) . '"';
        $this->header('ETag: ' . $etag);
        if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
            if ($_SERVER['HTTP_IF_NONE_MATCH'] === $etag) {
                $this->status(304);
                $this->removeHeader('Content-Type');
                $this->finish();
                return;
            }
        }
        $this->header('Content-Length: ' . mb_orig_strlen($html));
        echo $html;
        $this->finish();
    }
1331861
async function init () {
    // initialze logging
    initLogging(this.immutableApp)
    // initialize global dir config by merging module configs
    initDir(this.immutableApp)
    // initalize handlebars
    initHandlebars(this.immutableApp)
    // initalize express request handling - bodyParser, cookieParser, etc
    initExpress(this.immutableApp)
    // initialize app
    initApp(this.immutableApp)
    // add error handler after all other middleware and routers
    initErrorHandler(this.immutableApp)
    // initialize models
    await initModels(this.immutableApp)
    // intialize components after models since they may use models
    initComponents(this.immutableApp)
    // initialize services after models since they may use models
    await initServices(this.immutableApp)
    // set initialize flag to true
    this.immutableApp.initialized = true
    // debug
    debug('init', this.immutableApp)
}
1091462
function init(givenOptions) {
        options = $.extend({}, $.fn.imageupload.defaultOptions, givenOptions);

        var $imageupload = this;
        var $fileTab = $imageupload.find('.file-tab');
        var $fileTabButton = $imageupload.find('.panel-heading .btn:eq(0)');
        var $browseFileButton = $fileTab.find('input[type="file"]');
        var $removeFileButton = $fileTab.find('.btn:eq(1)');
        var $urlTab = $imageupload.find('.url-tab');
        var $urlTabButton = $imageupload.find('.panel-heading .btn:eq(1)');
        var $submitUrlButton = $urlTab.find('.btn:eq(0)');
        var $removeUrlButton = $urlTab.find('.btn:eq(1)');

        // Do a complete reset.
        resetFileTab($fileTab);
        resetUrlTab($urlTab);
        showFileTab($fileTab);
        enable.call($imageupload);
        
        // Unbind all previous bound event handlers.
        $fileTabButton.off();
        $browseFileButton.off();
        $removeFileButton.off();
        $urlTabButton.off();
        $submitUrlButton.off();
        $removeUrlButton.off();

        $fileTabButton.on('click', function() {
            $(this).blur();
            showFileTab($fileTab);
        });

        $browseFileButton.on('change', function() {
            $(this).blur();
            submitImageFile($fileTab);
        });

        $removeFileButton.on('click', function() {
            $(this).blur();
            resetFileTab($fileTab);
        });

        $urlTabButton.on('click', function() {
            $(this).blur();
            showUrlTab($urlTab);
        });

        $submitUrlButton.on('click', function() {
            $(this).blur();
            submitImageUrl($urlTab);
        });

        $removeUrlButton.on('click', function() {
            $(this).blur();
            resetUrlTab($urlTab);
        });
    }
659522
static function init()
  {
    if (self::$initialized) return;

    self::$initialized = TRUE;

    self::$COFFEE_KEYWORDS  = array_merge(self::$COFFEE_KEYWORDS, array_keys(self::$COFFEE_ALIASES));
    self::$COFFEE_RESERVED  = array_merge(self::$JS_RESERVED, self::$JS_KEYWORDS, self::$COFFEE_KEYWORDS, self::$STRICT_PROSCRIBED);
    self::$JS_FORBIDDEN     = array_merge(self::$JS_KEYWORDS, self::$JS_RESERVED, self::$STRICT_PROSCRIBED);
    self::$INDEXABLE        = array_merge(self::$CALLABLE, self::$INDEXABLE);
    self::$NOT_SPACED_REGEX = array_merge(self::$NOT_REGEX, self::$NOT_SPACED_REGEX);

    Rewriter::init();

    self::$INVERSES         = Rewriter::$INVERSES;
  }
131652
function init() {
    var tagName;
    for (var i = 0; i < allTags.length; i++) {
        tagName = allTags[i];
        elems[tagName] = makeElem(tagName);
    }
}
143516
function init(pluginInterface) {
    pi = pluginInterface;
    log = pi.log;
    localStorage = pi.localStorage;
}
209200
function Constructor() {
                // All construction is actually done in the init method.
                if (!initializing) {
                    return this.constructor !== Constructor && arguments.length ?
                    // We are being called without `new` or we are extending.
                    arguments.callee.extend.apply(arguments.callee, arguments) :
                    // We are being called with `new`.
                    this.constructor.newInstance.apply(this.constructor, arguments);
                }
            }
295532
public function init() {
		
		parent::init();

        $booster = Booster::getBooster();
		$popover = $booster->popoverSelector;
		$tooltip = $booster->tooltipSelector;

		$afterAjaxUpdate = "js:function() {
			jQuery('.popover').remove();
			jQuery('{$popover}').popover();
			jQuery('.tooltip').remove();
			jQuery('{$tooltip}').tooltip();
		}";

		if (!isset($this->afterAjaxUpdate)) {
			$this->afterAjaxUpdate = $afterAjaxUpdate;
		}
	}
863260
public function init()
    {
        $this->assets = array(
            'js' => YII_DEBUG ? 'foundation/foundation.reveal.js' : 'foundation.min.js'
        );

        Html::addCssClass($this->htmlOptions, Enum::DIALOG);
        $this->setId(ArrayHelper::removeValue($this->htmlOptions, 'id', $this->getId()));
        $this->registerClientScript();
        parent::init();

        $this->htmlOptions['id'] = $this->getId();

        echo $this->renderToggleButton() . "\n";
        echo \CHtml::openTag('div', $this->htmlOptions) . "\n";
        echo $this->renderHeader() . "\n";
    }
1330877
function init(pluginInterface) {
    const pi = pluginInterface;

    // Static contents call
    pi.http.endpoint('get', '*', (req, res, next) => {
        let path = req.path;
        if (path.charAt(path.length-1)=='/') path += 'index.html';

        const pt = pathm.join(pathm.dirname(__filename), 'htdocs', path);
        fs.readFile(pt, (err, data)=>{
            if (err) {
                res.status(404).send('No such resource');
                return;
            }
            if (path==='/js/customize.js') {
                data = data.toString();
                data = data.split('__%%RSA_PUB_KEY%%__')
                    .join('"'+pi.crypt.getPubKey()+'"');
            }
            res.set('Content-Type', mime.getType(path)); // 'text/html; charset=UTF-8'
            res.status(200);

            res.send(data);
        });
    });
}
41580
function init$1(params){
	var p = params || {};
	TRACE = p.TRACE || false;
	if (p.crossOrigin) { crossOrigin = p.crossOrigin; }
	if (p.baseUrl) { baseUrl = p.baseUrl; }
	if (baseUrl.slice(-1) !== '/') { baseUrl += '/'; }

	loader = new altspace.utilities.shims.OBJMTLLoader();
	loader.crossOrigin = crossOrigin;
	if (TRACE) { console.log('MultiLoader initialized with params', params); }
}
398
function initialize() {
  var flags = [];

  Object.keys( levels ).forEach(function( type, level ) {
    var method = type.toLowerCase();
    exports[ method ] = log.bind( exports, type, level, false );
    exports[ method ].json = log.bind( exports, type, level, true );
    if ( new RegExp( '\\b' + type + '\\b', 'i' ).test( env ) ) {
      flags.push( level );
    }
  });

  loglevel = Math.min.apply( Math, flags );
}
735847
protected function _init() {
		parent::_init();
		$this->request = $this->_config['request'];

		if (!is_object($this->request) || !$this->request->params) {
			return;
		}
		$default = ['command' => null, 'action' => null, 'args' => null];
		$params = array_diff_key((array) $this->request->params, $default);

		foreach ($params as $key => $param) {
			$this->{$key} = $param;
		}
		$this->response = $this->_config['response'];

		if (!is_object($this->response)) {
			$this->response = $this->_instance('response', $this->response + [
				'plain' => $this->plain
			]);
		}
	}
646427
function init() {
      if ($el.hasClass('horizontal')){
        scrollDirection = 'horiz';
        scrollOffsetAttr = 'scrollLeft';
        sizeAttr = 'width';
        offsetAttr = 'left';
      }

      $el.prepend('<div class="tse-scrollbar"><div class="drag-handle"></div></div>');
      $scrollbarEl = $el.find('.tse-scrollbar');
      $dragHandleEl = $el.find('.drag-handle');

      if (options.wrapContent) {
        $contentEl.wrap('<div class="tse-scroll-content" />');
      }
      $scrollContentEl = $el.find('.tse-scroll-content');

      resizeScrollContent();

      if (options.autoHide) {
        $el.on('mouseenter', flashScrollbar);
      }

      $dragHandleEl.on('mousedown', startDrag);
      $scrollbarEl.on('mousedown', jumpScroll);
      $scrollContentEl.on('scroll', onScrolled);

      resizeScrollbar();

      $(window).on('resize', function() {
        recalculate();
      });

      if (!options.autoHide) {
        showScrollbar();
      }
    }
467198
public static void initialize() {
		if (isInitialized) {
			return;
		}
		isInitialized = true;
		printLogo();
		try {
			logger.info("--- Para.initialize() [{}] ---", Config.ENVIRONMENT);

			for (InitializeListener initListener : INIT_LISTENERS) {
				if (initListener != null) {
					initListener.onInitialize();
					logger.debug("Executed {}.onInitialize().", initListener.getClass().getName());
				}
			}
			logger.info("Instance #{} initialized.", Config.WORKER_ID);
		} catch (Exception e) {
			logger.error("Failed to initialize Para.", e);
		}
	}
1352268
function constructor(username) {
    /*
     * Set itemsPerPage variable
     *
     * @param Mixed newItemsPerPage
     */

    function setItemsPerPage(newItemsPerPage) {
        itemsPerPage = newItemsPerPage;
    }

    /*
     * Get itemsPerPage variable
     *
     */

    function getItemsPerPage() {
        return itemsPerPage;
    }

    /*
     * Set currentPage variable
     *
     * @param Number newItemsPerPage
     */

    function setCurrentPage(newCurrentPage) {
        currentPage = newCurrentPage;
    }

    /*
     * Get currentPage variable
     *
     */

    function getCurrentPage() {
        return currentPage;
    }

    /*
     * Get all the boards for the user
     *
     * @param boolean paginate
     * @param Function callback
     * @invoke callback(Mixed boards)
     */

    function getBoards(paginate, callback) {
        var boardsResponse;

        // Check for cache existence
        getCache('boards_' + username, true, function (cacheData) {
            if (cacheData === null) {
                // Create get request and put it in the cache
                get('http://pinterestapi.co.uk/' + username + '/boards', true, function (response) {
                    putCache('boards_' + username, JSON.stringify(response));

                    if (paginate) {
                        boardsResponse = buildResponse(response.body ? response.body : []);
                    } else {
                        boardsResponse = response.body ? response.body : [];
                    }
                    callback(boardsResponse);
                    return;
                });
            } else {
                if (paginate) {
                    boardsResponse = buildResponse(cacheData.body ? cacheData.body : []);
                } else {
                    boardsResponse = cacheData.body ? cacheData.body : [];
                }
                callback(boardsResponse);
                return;
            }
        });
    }

    /*
     * Get pins from a single board
     *
     * @param string board
     * @param boolean paginate
     * @param Function callback
     * @invoke callback(Mixed pins)
     */

    function getPinsFromBoard(board, paginate, callback) {
        var pins = [];
        var pinDateMap = {};

        async.parallel([
            function (asyncCallback) {
                getCache(board, true, function (cacheData) {
                    if (cacheData === null) {
                        // Get data and put it in the cache
                        get('https://api.pinterest.com/v3/pidgets/boards/' + username + '/' + board.replace(/#/g, '') + '/pins/', true, function (response) {
                            putCache(board, JSON.stringify(response));
                            pins = response.data ? response.data.pins : [];
                            asyncCallback();
                        });
                    } else {
                        pins = cacheData.data ? cacheData.data.pins : [];
                        asyncCallback();
                    }
                });
            },
            function (asyncCallback) {
                if (!obtainDates) {
                    asyncCallback();
                    return;
                }

                getDatesForBoardPinsFromRss(username, board, function (dates) {
                    pinDateMap = dates;
                    asyncCallback();
                    return;
                });
            }],
            function (err) {
                if (err) { throw err; }
                var pinIdsThatNeedDates = [];
                for (var i = 0; i < pins.length; i++) {
                    pins[i].created_at = null;
                    pins[i].created_at_source = null;
                    if (pinDateMap[pins[i].id]) {
                        pins[i].created_at = pinDateMap[pins[i].id];
                        pins[i].created_at_source = 'rss';
                    } else {
                        pinIdsThatNeedDates.push(pins[i].id);
                    }
                }

                if (obtainDates) {
                    getDatesForPinsFromScraping(pinIdsThatNeedDates, null, function (scrapedPinDateMap) {
                        for (var i = 0; i < pins.length; i++) {
                            if (scrapedPinDateMap[pins[i].id] && scrapedPinDateMap[pins[i].id].date) {
                                pins[i].created_at = scrapedPinDateMap[pins[i].id].date;
                                pins[i].created_at_source = scrapedPinDateMap[pins[i].id].source;
                            }
                        }
                        if (paginate) {
                            pins = buildResponse(pins);
                        }

                        callback(pins);
                        return;
                    });
                } else {
                    if (paginate) {
                        pins = buildResponse(pins);
                    }

                    callback(pins);
                    return;
                }
            }
        );
    }

    /*
     * Get all the user's pins (from all boards we can get)
     *
     * @param Function callback
     * @invoke callback(Object pins)
     */

    function getPins(callback) {
        var allPins = [];
        getBoards(false, function (boards) {
            async.each(boards, function(board, asyncCallback) {
                var splitHref = board.href.split('/');
                if (splitHref[1] === username) { // it's possible to have boards listed from other users
                    var boardHref = board.href.split('/')[2];
                    getPinsFromBoard(boardHref, false, function (pins) {
                        allPins = allPins.concat(pins);
                        asyncCallback();
                    });
                } else {
                    asyncCallback();
                }
            },
            function (err) {
                if (err) {
                    console.error('Error iterating through each board to get pins');
                    throw err;
                }
                callback(buildResponse(allPins));
                return;
            });
        });
    }

    /*
     * Get obtainDates variable
     *
     */

    function getObtainDates() {
        return obtainDates;
    }

    /*
     * Set obtainDates variable
     *
     * @param boolean bool
     */

    function setObtainDates(bool) {
        obtainDates = bool;
    }

    return {
        getPins: getPins,
        getBoards: getBoards,
        getPinsFromBoard: getPinsFromBoard,
        getCurrentPage: getCurrentPage,
        setCurrentPage: setCurrentPage,
        getItemsPerPage: getItemsPerPage,
        setItemsPerPage: setItemsPerPage,
        getObtainDates: getObtainDates,
        setObtainDates: setObtainDates
    };
}