Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am wulftone on github.
  • I am wulftone (https://keybase.io/wulftone) on keybase.
  • I have a public key ASA5gAnhddkyQNChAG7nJfZqpcIM5EML67L74--1rquhogo

To claim this, I am signing this object:

@wulftone
wulftone / factorial.js
Created November 27, 2013 09:49
Factorial function, recursive and cached for fast re-lookup.
(function(){
// Save a reference to the global object (`window` in the browser, `exports`
// on the server).
var root = this,
// Save the previous value of the `Factorial` variable, so that it can be
// restored later on, if `noConflict` is used.
previousFactorial = root.Factorial,
// The top-level namespace. All public Factorial classes and modules will
@wulftone
wulftone / debounce.coffee
Last active December 19, 2015 09:09
A simple debouncing function that only executes the function after all input has stopped. http://blog.gaslight.co/page/3
###
source: http://blog.gaslight.co/page/3
Debounce a function so it only executes once, after all inputs to it have ended, or after
a specified timeout interval. Optionally pass another argument to your debounced function
to execute it immediately, for example: `myDebouncedFunction( some, arguments, { now: true } )`
@example An Ember.js controller example usage
App.DocumentController = Ember.ObjectController.extend
@wulftone
wulftone / trello_lindy_json_to_file.rb
Created May 17, 2013 04:35
Made specifically for a Trello project, this script will troll through your Trello JSON export data and pick out the names of your Trello cards and Lists, and save them to a new file.
#! /usr/bin/ruby
# This file is intended to be used for a specific trello project, but the principle
# displayed here of extracting data from a trello json export file can be used in
# a wide variety of ways. Edit this file to your heart's content!
#
# Put this file in the same folder as "lindy-hop-thesaurus.json" (or whatever your
# Trello export file is called... and run it from the command line like this:
#
# ruby print_json.rb lindy-hop-thesaurus.json
@wulftone
wulftone / mon
Last active December 16, 2015 15:29
Monitor some random process by current user and process name and notify when it is complete
#!/usr/bin/env ruby
# Usage:
#
# ./mon git 0.3 # => will monitor "git" every 0.3 seconds until it dies
start = Time.now
user = `whoami`.strip
name = ARGV[0]
frequency = (ARGV[1] || 1).to_f # Default to 1 second if second argument not given
@wulftone
wulftone / Default.sublime-theme
Created April 22, 2013 19:16
Dark Sublime Text theme
[
{
"class": "label_control",
"color": [255, 255, 255],
"shadow_color": [24, 24, 24],
"shadow_offset": [0, -1]
},
{
"class": "button_control",
"content_margin": [6, 5, 6, 6],
@wulftone
wulftone / note.dtd
Last active September 26, 2020 06:23
Simple xml-dtd validator
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
@wulftone
wulftone / config.ru
Last active December 16, 2015 04:19
Silly little webserver
# If you have ruby installed, you can use this file to run a basic web server
# and avoid silly cross-site forgery issues when doing your assignments.
#
# * Install ruby, if you haven't already
# Macs come with ruby, so just open up a terminal and type: ruby -v
# and press Return (or Enter or whatever). If you get a response,
# you have ruby already! Move to the next step. If not, consult Google.
#
# Windows users can easily install ruby, just check out http://rubyinstaller.org/
# When you're done installing, open up a command prompt (or powershell) and

Demo

console.log 'hello'
print 'world!'
@wulftone
wulftone / backbone-rivets.config.js
Last active December 12, 2015 09:29
Rivetsjs adapter for backbonejs
rivets.configure({
adapter: {
subscribe: function(obj, keypath, callback) {
if (obj instanceof Backbone.Collection) {
obj.on('add remove reset', function () {
callback(obj[keypath])
});
} else {
obj.on('change:' + keypath, function (m, v) { callback(v) });
};