Skip to content

Instantly share code, notes, and snippets.

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));
});
@tomaskikutis
tomaskikutis / gist:157dcaf16483363624fd519d368ab5a2
Created April 21, 2016 06:08 — forked from ebuildy/gist:5d4ad0998848eaefdad8
Setup sentry logger on a fresh Ubuntu server
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';"
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")
@tomaskikutis
tomaskikutis / app.tsx
Created September 20, 2015 19:01
react typescript browserify
// 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> {
@tomaskikutis
tomaskikutis / gist:517657c4675ce580b1f7
Created February 10, 2015 12:15
GULP task for compiling HTMLBARS templates for use in the browser
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("\\", "/");
}
# 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 ->