Skip to content

Instantly share code, notes, and snippets.

View founddrama's full-sized avatar
🗺️
time zone chauvinist

Rob Friesel founddrama

🗺️
time zone chauvinist
View GitHub Profile
@founddrama
founddrama / tetris.clj
Created September 16, 2011 17:40 — forked from fogus/tetris.clj
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)
@founddrama
founddrama / 0_selector_hacks.scss
Created September 19, 2011 00:33 — forked from chriseppstein/0_selector_hacks.scss
This gist demonstrates some uses of the new sass feature: Passing content blocks to mixins.
@mixin ie6 { * html & { @content } }
#logo {
background-image: url("/images/logo.png");
@include ie6 { background-image: url("/images/logo.gif"); }
}
@founddrama
founddrama / dry-with-sass-lists.scss
Created December 12, 2011 20:32 — forked from ry5n/dry-with-sass-lists
Using Sass lists for DRY-er code
// Shared colors for buttons and alerts
//
// Use Sass lists to avoid writing out repeating patterns of Sass code.
//
// For example, the following avoids having to write out a selector and
// set of style rules for each alert type, when only class and
// variable names are different.
//
// Follows (and many thanks to) Nathan Weizenbaum (@nex3)’s comment at:
// http://groups.google.com/group/sass-lang/msg/987926ad9fe5ad43?
@founddrama
founddrama / goodreads_csv_filter.rb
Created January 5, 2012 02:53 — forked from fogus/goodreads_csv_filter.rb
Trims Goodreads CSV files so they import into Delicious Library essential data only.
#!/usr/bin/env ruby -w
#
# Trims Goodreads CSV files so they import into Delicious Library essential data only.
#
require 'rubygems'
require 'faster_csv'
path = ARGV.empty? ? "/Users/rgreen/Downloads/goodreads_export.csv" : ARGV[0]
/*
* Non-clamped setInterval
* By Devon Govett (idea from sink.js)
* MIT LICENSE
*/
(function() {
var BlobBuilder = this.BlobBuilder || this.MozBlobBuilder || this.WebKitBlobBuilder,
URL = this.URL || this.webkitURL,
@founddrama
founddrama / example.js
Created January 30, 2012 11:53 — forked from Gozala/example.js
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
/**
* Scans the provided filter object for filters matching `inStack`.
*
* @method _filter
* @private
* @param {Object} filter An object representing a set of filters for a given object
* @param {Array} inStack An array of path properties [ 'a', 'b', 'c' ] is a path to { a: { b: { c: '...' } } } that will be used to look for whitelist entries.
* @param {Object} inObject An object representing the value at the end of `s`. In the above example, it would be '...'. Passed into the filter function, if one exists.
* @return {Boolean} True if this value should be returned by the object serializer, false if not.
**/
@founddrama
founddrama / cljsc.rb
Created March 6, 2012 16:19 — forked from fogus/cljsc.rb
ClojureScript compiler from JRuby
# clojurescript compiler from JRuby
# see https://github.com/clojure/clojurescript/wiki/Quick-Start
require 'java'
CLOJURESCRIPT_HOME = File.dirname(__FILE__)
$: << CLOJURESCRIPT_HOME
%w{compiler.jar goog.jar js.jar clj cljs}.each {|path| $CLASSPATH << CLOJURESCRIPT_HOME + "/" + path}
require 'clojure'
@founddrama
founddrama / gist:2345068
Created April 9, 2012 18:02 — forked from panicsteve/gist:1641705
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
/*
* Customize Footnotify on your site by adding custom css.
*
* This file is NOT loaded by the script and must be
* implemented on the site in order to apply.
*
* More info: https://gist.github.com/1046538
*
*/