Skip to content

Instantly share code, notes, and snippets.

View jimeh's full-sized avatar

Jim Myhrberg jimeh

View GitHub Profile
@schacon
schacon / gist:1
Created July 15, 2008 18:17
the meaning of gist
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
@jimeh
jimeh / _NOTE.md
Created November 16, 2009 00:16
My Git related config and aliases

NOTE

This gist is now deprecated as I've finally sorted out and made my dotfiles public.

My ~/.gitconfig is available here, and my git-related shell setup here.

@defunkt
defunkt / connection_fix.rb
Created November 19, 2009 20:00
MySQL server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
;; emacsd-tile.el -- tiling windows for emacs
(defun swap-with (dir)
(interactive)
(let ((other-window (windmove-find-other-window dir)))
(when other-window
(let* ((this-window (selected-window))
(this-buffer (window-buffer this-window))
(other-buffer (window-buffer other-window))
(this-start (window-start this-window))
# From Bryan Liles on the Practicing Ruby Discussion List
1. TDD is a great tool. As a tool, you'll use it when appropriate.
TATFT mostly means that you should be thinking about how you can put
whatever you are creating under test at all times. Writing tests for
the sake of writing tests is silly.
2. Like Gregory stated, brittle tests aren't helping anyone. Think
about the ingress/egress points of your objects at all times.
@timblair
timblair / caveatPatchor.js
Created February 15, 2011 10:27 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above: pulls avatars from Gravatar
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@jimeh
jimeh / jquery.myplugin.coffee
Created April 7, 2011 23:44
Example jQuery plugin written in CoffeeScript, and the resulting compiled JavaScript file.
$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.default_options, options
$(this).each (i, el) ->
self.init el, opts
self.log el if opts.log
$.extend $.fn.myplugin,
default_options:
@eculver
eculver / recursive remove .AppleDouble directories
Created May 26, 2011 00:03
recursive remove .AppleDouble directories
find . -name \.AppleDouble -exec rm -rf {} \;
@bretthoerner
bretthoerner / fullscreen-24.diff
Created June 7, 2011 19:13
Add ns-toggle-fullscreen to Emacs 24
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 157b2dd..f3807b7 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1263,6 +1263,11 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()
@jimeh
jimeh / decode.rb
Created August 20, 2011 13:56
Ruby-based Benchmark of MessagePack vs. JSON & Yajl
# encoding: utf-8
require 'bench_press'
require 'json'
require 'yajl'
require 'msgpack'
extend BenchPress
reps 10_000