Skip to content

Instantly share code, notes, and snippets.

@kinsteronline
kinsteronline / memo.coffee
Created December 19, 2013 17:36
the async.memoize is pretty awesome
#
# That time I used async.memoize
#
# Because it was a small bursty type thing, I memoized it
#
remoteCall = (name, cb) ->
theActualCall name, (err, resp) ->
cb err, resp
execRemoteCall = async.memoize remoteCall
/**
* Parse query string.
* ?a=b&c=d to {a: b, c: d}
* @param {String} (option) queryString
* @return {Object} query params
*/
getQueryParams: function(queryString) {
var query = (queryString || window.location.search).substring(1); // delete ?
if (!query) {
return false;
<html>
<head>
<title>Simple Line Graph using SVG and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@kinsteronline
kinsteronline / install_ruby.sh
Created August 13, 2013 19:35
Install ruby 2.0 with checkinstall
sudo apt-get install checkinstall
./configure --disable-install-doc
make
sudo checkinstall --pkgname="ruby" --pkgversion="2.0.0-p247"
dpkg -r ruby
@kinsteronline
kinsteronline / pr.coffee
Created July 30, 2013 23:08
hiding package li with recursion
removeSlice = offersOnScreen.slice(-offerPackagesPerPage).toArray()
removePackage = (pkgs) ->
pkg = pkgs.pop()
if pkg
$(pkg).fadeOut 100, ->
$(this).remove()
removePackage(pkgs)
removePackage(removeSlice)
@kinsteronline
kinsteronline / gist:5958989
Created July 9, 2013 16:43
Bash renames, for future reference. Just wanted something quick, I'm sure there is a better way.
#!/bin/bash
for file in *.coffee; do
filename=$(basename "$file")
ext="${filename##*.}"
filename="${filename%.*}"
git mv "$file" "$filename.js.$ext"
done
for lessfile in *.less; do
@kinsteronline
kinsteronline / gist:5918594
Created July 3, 2013 14:42
So I watched Eric Leads talk at Fluent 2013...I really liked the composition he implemented...I'm going to blatantly copy it.
#
# Base abilities mixin
abilitiesPrototype = (() ->
str = 9
strAdj = 0
dex = 9
dexAdj = 0
int = 9
intAdj = 0
wis = 9
######################################################################
# CURRENT AWARE LOCAL DATETIME
######################################################################
from datetime import datetime
from tzlocal import get_localzone
local_tz = get_localzone()
local_dt = datetime.now(local_tz)
@kinsteronline
kinsteronline / gist:5256816
Created March 27, 2013 18:31
note sure how I feel about these....
wave = 'Shockwave';
force = 84;
liquidObject["make" + wave ](force);
makeShockwave.apply(liquidObject, [force]);