Skip to content

Instantly share code, notes, and snippets.

@krbullock
krbullock / keybindings.el
Created March 26, 2012 16:03
Here's a better way:
(defun jeg2s-yank-and-select ()
"This is a test command for how to create a selection."
(interactive)
(let (deactivate-mark)
(kill-new "selected")
(yank)
(exchange-point-and-mark)))
(global-set-key (kbd "C-c y") 'jeg2s-yank-and-select)
; See http://www.gnu.org/software/emacs/manual/html_node/elisp/The-Mark.html#index-deactivate_002dmark-2507
#Newbie programmer
def factorial(x)
if x == 0
return 1
else
return x * factorial(x - 1)
end
end
puts factorial(6)
@krbullock
krbullock / gist:191297
Created September 22, 2009 18:18 — forked from texel/gist:191269
class FooBarTransactionFailed < ActiveRecord::RecordInvalid
def initialize(foo, bar)
@foo, @bar = foo, bar
end
end
begin
transaction do
foo = FooClass.create(:blah => 'blah')
bar = BarClass.create(:bleh => 'bleh')