This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tsc --watch | xargs -L1 -I{} terminal-notifier -message '{}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $bbSetElement = Backbone.View.prototype.setElement; | |
Backbone.View.prototype.setElement = function setElement(element) { | |
if (this.el && this.el !== element) { | |
delete this.el.$bbView; | |
} | |
const domElem = element.jquery ? element[0] : element; | |
domElem.$bbView = this; | |
domElem.setAttribute(`data-backbone-view`, `true`); | |
return $bbSetElement.apply(this, arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-env node */ | |
const fs = require(`fs`); | |
const path = require(`path`); | |
const filePaths = fs.readFileSync(`${__dirname}/file_list.txt`, `utf-8`).trim().split(`\n`); | |
console.log(`Total files`, filePaths.length); | |
for (let i = 0, len = filePaths.length; i < len; ++i) { | |
const filePath = filePaths[i]; | |
let lines = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Problem: Write a class that implements the following iterator interface: | |
bool hasNext() | |
int next() | |
The iterator is used to sequentially iterate over a collection. Given an implementation of this iterator MyIterator, its usage can be summarized by the following snippet: | |
input = [1,2,3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ********** | |
* ** TIPS ** | |
* ********** | |
* Please write high level pseudocode approach before writing actual code. | |
* Use meaningful variables, comments and indent your code. | |
* Your code should compile, run and produce the correct output. | |
* Don't need to test extensively but describe what kind of tests you'll add as 'TODO:' comments | |
* You are totally free to use google and stackoverflow. | |
* Talk about O(n) CPU and memory requirements. Best case and worst case. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A simple helper for creating nested dom tree inspired by snabbdom-jsx syntax | |
* @param {string} name | |
* @param {{[attr: string]: any}} attrs | |
* @param {Array<HTMLElement | string>} children | |
* @returns {HTMLElement} | |
*/ | |
export function createElem(name, attrs, children) { | |
const elem = document.createElement(name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import json | |
import os | |
import sys | |
from os import path | |
from urllib import urlopen | |
asset_diff_dir = '/tmp/_asset_diff' | |
def load_file(file): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wordsToNumMap = { | |
zero: 0, | |
one: 1, | |
two: 2, | |
three: 3, | |
four: 4, | |
five: 5, | |
six: 6, | |
seven: 7, | |
eight: 8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moduleMap = {}; | |
for (const p of webpackJsonp) { | |
const modules = p[1]; | |
for (const [moduleName, moduleFn] of Object.entries(modules)) { | |
const moduleContent = moduleFn.toString(); | |
const nameParts = moduleName.split(`!`); | |
const moduleId = nameParts[nameParts.length - 1] + (nameParts.length > 1 ? `!` : ``); | |
if (!moduleMap[moduleId]) { | |
moduleMap[moduleId] = moduleContent | |
} else if (moduleMap[moduleId] !== moduleContent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const START = `start`; | |
const END = `end`; | |
export class PerfMeasure { | |
public measureName: string; | |
public started: boolean; | |
public ended: boolean; | |
constructor(measureName: string) { | |
this.measureName = measureName; |