Skip to content

Instantly share code, notes, and snippets.

@jesseditson
jesseditson / node-debug
Last active August 29, 2015 13:56
node-debug
#!/bin/bash
node-inspector --web-port 8080 &
sleep 1
URL="http://127.0.0.1:8080/debug?port=5858"
echo "
tell application \"Google Chrome\"
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
[{"title":"Graph","height":"350px","editable":true,"collapse":false,"collapsable":true,"panels":[{"span":12,"editable":true,"group":["default"],"type":"histogram","mode":"count","time_field":"@timestamp","value_field":null,"auto_int":true,"resolution":100,"interval":"10m","fill":3,"linewidth":3,"timezone":"browser","spyable":true,"zoomlinks":true,"bars":true,"stack":true,"points":false,"lines":false,"legend":true,"x-axis":true,"y-axis":true,"percentage":false,"interactive":true,"queries":{"mode":"all","ids":[0]},"title":"Events over time","intervals":["auto","1s","1m","5m","10m","30m","1h","3h","12h","1d","1w","1M","1y"],"options":true,"tooltip":{"value_type":"cumulative","query_as_alias":true},"scale":1,"y_format":"none","grid":{"max":null,"min":0},"annotate":{"enable":false,"query":"*","size":20,"field":"_type","sort":["_score","desc"]},"pointradius":5,"show_query":true,"legend_counts":true,"zerofill":true,"derivative":false}],"notice":false},{"title":"Events","height":"350px","editable":true,"collapse":fal
@jesseditson
jesseditson / index.js
Created July 1, 2015 23:11
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var d3 = require('d3')
var width = 960,
height = 500,
radius = 80,
x = Math.sin(2 * Math.PI / 3),
y = Math.cos(2 * Math.PI / 3);
@jesseditson
jesseditson / gist:63a2387bfec72dc35bb1
Created July 10, 2015 20:39
module swapper first pass
This file has been truncated, but you can view the full file.
---------- diff:
app.js
+ /* global dependencies */
+ var $ = require('jquery');
+ var Backbone = require('backbone');
+ var Marionette = require('marionette');
/** @class */
var AdvisorApp = new Marionette.Application({
@jesseditson
jesseditson / couchdb-ec2-install.sh
Created April 12, 2012 04:42 — forked from msmith/couchdb-ec2-install.sh
Set up CouchDB on EC2
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
sudo mkdir -p /usr/local/var/run/couchdb
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
@jesseditson
jesseditson / pal.js
Created February 28, 2013 22:07
A small node script for detecting if a word is a palindrome
#!/usr/bin/env node
var word = process.argv.slice(2)[0]
if(!word) return console.error("Please call this script with a word, e.g.: \n node pal.js someword")
// split the word into letters
var letters = word.split('')
var i=0
var len = letters.length
@jesseditson
jesseditson / jetstreams.py
Last active December 14, 2015 17:59
A python exercise to find the best route in a field of jetstreams: First line contains only 1 integer, which is the constant energy it takes to fly 1 mile WITHOUT jet streams. Every subsequent line contains 3 space-separated integers: the start mile marker of the jet stream, the end mile marker of the jet stream, and lastly an integer denoting t…
import sys
import os
# make sure we were called with the proper args
if len(sys.argv) < 2 :
print "Error: please call this script with a filename, e.g."
print "jetstreams.py <somefilename.txt>"
exit(1)
# make sure the file name called with exists
@jesseditson
jesseditson / installSlow.sh
Created June 14, 2013 01:41
Installs 2 utilities - slow, and unslow. Will throttle your unix machine's connection to the internet. Good for testing what your website looks like on a shitty connection.
#!/bin/bash
BINEXISTS=`echo $PATH | grep /usr/local/bin`
if [ -z $BINEXISTS ]
then
echo "This script installs slow and unslow to /usr/local/bin, but it is not in your path."
echo "Please add /usr/local/bin to your path and run this script again."
exit 1
fi
if [[ $1 = "uninstall" ]]