Skip to content

Instantly share code, notes, and snippets.

View hacker-news-top-10.js
const topStoriesUrl = "";
const getStoryInfoUrl = storyId => `${storyId}.json`
const getUserInfoUrl = userId => `${userId}.json`
function fetchJson(method, url){
return new Promise(function(resolve, reject){
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", function(){
tomaskikutis / gist:157dcaf16483363624fd519d368ab5a2
Created Apr 21, 2016 — forked from ebuildy/gist:5d4ad0998848eaefdad8
Setup sentry logger on a fresh Ubuntu server
View gist:157dcaf16483363624fd519d368ab5a2
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';"
View get-largest-binary-gap.js
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 / app.tsx
Created Sep 20, 2015
react typescript browserify
View app.tsx
// 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> {
# 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 ->
tomaskikutis / gist:517657c4675ce580b1f7
Created Feb 10, 2015
GULP task for compiling HTMLBARS templates for use in the browser
View gist:517657c4675ce580b1f7
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("\\", "/");