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 topStoriesUrl = "https://hacker-news.firebaseio.com/v0/topstories.json"; | |
const getStoryInfoUrl = storyId => `https://hacker-news.firebaseio.com/v0/item/${storyId}.json` | |
const getUserInfoUrl = userId => `https://hacker-news.firebaseio.com/v0/user/${userId}.json` | |
function fetchJson(method, url){ | |
return new Promise(function(resolve, reject){ | |
var oReq = new XMLHttpRequest(); | |
oReq.addEventListener("load", function(){ | |
resolve(JSON.parse(this.responseText)); | |
}); |
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
sudo apt-get update | |
sudo apt-get install python-virtualenv | |
sudo apt-get install python-dev | |
sudo apt-get install postgresql | |
sudo apt-get install postgresql-server-dev-9.3 | |
sudo apt-get install redis-server | |
sudo -u postgres createuser -s sentry | |
sudo -u postgres psql -c "alter user sentry with password 'sentry';" |
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 trim = require("lodash/trim"); | |
var max = require("lodash/max"); | |
var dec2bin = function (dec){ | |
return (dec >>> 0).toString(2); | |
}; | |
var getLargestBinaryGap = function(n){ | |
return max( | |
trim(dec2bin(n), "0") |
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
// npm install browserify -g | |
// npm install tsd -g | |
// npm install react tsify | |
// tsd install react | |
// browserify app.tsx -p [tsify --jsx=react] -o bundle.js | |
/// <reference path="typings/react/react.d.ts" /> | |
import React = require("react"); | |
interface HelloWorldComponentProps extends React.Props<any> { |
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
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
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 htmlbars = require("gulp-htmlbars"); | |
var tap = require("gulp-tap"); | |
var concat = require("gulp-concat"); | |
var getTemplateNameFromPath = function(path){ | |
// if exist replace \ with / | |
while( path.indexOf("\\") !== -1 ){ | |
path = path.replace("\\", "/"); | |
} |