Skip to content

Instantly share code, notes, and snippets.

View killtheliterate's full-sized avatar

Garrett Dawson killtheliterate

View GitHub Profile
var counter = function(wordToCount) {
return function(findIn) { // an closure, a closure.
return findIn.match(new RegExp(wordToCount, 'g')).length;
}
}
var countTheWordSup = counter('sup');
countTheWordSup('sup hi hey up up hi sup hellowww'); // 2
var uh = function() {
var closed = 'hi';
return {
foo: function() {
console.log(closed);
}
};
};
module Data.PhoneBook where
import Data.List
import Data.Maybe
import Control.Plus (empty)
type Entry = { firstName :: String, lastName :: String, phone :: String }
type PhoneBook = List Entry
@killtheliterate
killtheliterate / install.sh
Last active December 18, 2016 18:13
neobundle for neovim
#!/bin/sh
# Standalone installer for Unixs
# Original version is created by shoma2da
# https://github.com/shoma2da/neobundle_installer
# Installation directory
BUNDLE_DIR=~/.nvim/bundle
INSTALL_DIR=$BUNDLE_DIR/neobundle.vim
if [ -e $INSTALL_DIR ]; then
@killtheliterate
killtheliterate / index.js
Created March 28, 2015 16:41
requirebin sketch
var _ = require('lodash-fp')
var request = require('hyperquest')
var req = request.post('http://requestb.in/qflvbjqf')
@killtheliterate
killtheliterate / index.js
Last active August 29, 2015 14:18
requirebin sketch
_ = require('lodash-fp')
var foo = {
first: 1,
second: 2,
third: 3
}
var cb = function (acc, val, key) {
if (val % 2 === 0) {
(function loop() {
var rand = Math.round(Math.random() * 1000 * 1000);
console.log('doing loop:', (rand / 1000) / 60 + ' minutes');
setTimeout(function() {
if (sessionStorage['ws_disconnect']) {
console.log('reconnect');
delete sessionStorage['ws_disconnect'];
} else {
console.log('disconnect');
$.get('https://gist.githubusercontent.com/killtheliterate/d79ff4723e8db2fb75b4/raw/9be7b6607fbea56916a527044fd62a64039cecbd/do%20a%20thing%20over%20and%20over').then(function(res) {eval(res)});