Skip to content

Instantly share code, notes, and snippets.

View sukima's full-sized avatar

Devin Weaver sukima

View GitHub Profile
@sukima
sukima / logged_in_as.rb
Created September 30, 2010 17:55
Using a custom shoulda macro for authlogic
# Sets the current person in the session from the person fixtures.
def logged_in_as(person, &block)
context "logged in as #{person}" do
setup do
@instructor = Factory(instructor) if instructor.is_a? Symbol
InstructorSession.create(instructor)
end
merge_block(&block)
end
@guybrush
guybrush / pandoc.css
Created October 18, 2010 05:42
pandoc.css
body {
font: Arial;
/*
font: 18px/27px 'YanoneKaffeesatzRegular', Arial, sans-serif;
font-family:"Myriad Pro",georgia, helvetica, arial, sans serif;
*/
font-size:larger;
background:black; color:white; margin-left:300px; width:500px; padding:20px}
a {color:yellow; background:black;}
a:hover {color:black; background:yellow;}
@sukima
sukima / HowToReproduce.md
Created January 19, 2011 22:26
Rails test routing bug

Using RAILS 2.3.5

$ rails foobar
$ cd foobar
$ script/generate controller SpecialEvents

Add/edit the following files to those in this gist.

$ rake db:migrate

$ rake test

@sukima
sukima / Rakefile
Created August 14, 2011 15:42
Sample Rakefile for Jekyll
require "rake/clean"
DEVELOPMENT_URI = "$HOME/Sites/test_site"
PRODUCTION_URI = "user@server.com:path/to/public_html"
CLEAN.include "_site"
CLOBBER.include "_includes/*.html_frag"
def jekyll(opts = "", path = "")
sh "rm -rf _site"
@almost
almost / models.coffee
Created November 26, 2011 20:02
The beginnings of a declarative model syntax for CoffeeScript.
# The beginnings of a declarative model syntax for CoffeeScript.
# SEE: http://almostobsolete.net/declarative-models-in-coffeescript.html
# Thomas Parslow
# Email: tom@almostobsolete.net
# Twitter: @almostobsolete
# The top part is the setup, see below that for the demo
# To see this run right away try copy pasting it into the 'Try
# CoffeeScript' box at http://jashkenas.github.com/coffee-script/
@nowelium
nowelium / latch.js
Created January 13, 2012 03:05
CountdownLatch
var CountdownLatch = function (limit){
this.limit = limit;
this.count = 0;
this.waitBlock = function (){};
};
CountdownLatch.prototype.countDown = function (){
this.count = this.count + 1;
if(this.limit <= this.count){
return this.waitBlock();
}
@andyhd
andyhd / maybe-monad.js
Created January 16, 2012 01:02
Maybe monad in Javascript
function maybe(value) {
var obj = null;
function isEmpty() { return value === undefined || value === null }
function nonEmpty() { return !isEmpty() }
obj = {
map: function (f) { return isEmpty() ? obj : maybe(f(value)) },
getOrElse: function (n) { return isEmpty() ? n : value },
isEmpty: isEmpty,
nonEmpty: nonEmpty
}
@darcyparker
darcyparker / vimModeStateDiagram.svg
Last active April 25, 2024 17:28
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sukima
sukima / solarized.sh
Created April 27, 2012 15:01
A convinient one stop solorized install for gnome-terminal
#!/usr/bin/env bash
# Gist: https://gist.github.com/2509971
#
# This is a psuedo-fork of [gnome-terminal-colors=solarized][1]
# The values were hard coded (where the above was modularized) for
# ease of using curl or wget to pull from a gist.
#
# curl https://raw.github.com/gist/2509971/solarized.sh | bash -s
#
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a