Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am krbullock on github.
  • I am krbullock (https://keybase.io/krbullock) on keybase.
  • I have a public key whose fingerprint is 3A81 5516 3D0E 20A5 30FC B786 47A6 7FFA A346 AACE

To claim this, I am signing this object:

@krbullock
krbullock / gist:5424730
Created April 20, 2013 04:17
Access denied installing gems system-wide with RubyGems 2.0.3
⁖ echo 'source "https://rubygems.org"' > Gemfile
⁖ echo 'gem "rake"' >> Gemfile
⁖ DEBUG=1 bundle
Fetching from: https://rubygems.org/api/v1/dependencies
HTTP Redirection
Fetching from: https://bundler.rubygems.org/api/v1/dependencies
HTTP Success
Fetching gem metadata from https://rubygems.org/
Query List: ["rake"]
Query Gemcutter Dependency Endpoint API: rake
@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
@krbullock
krbullock / ec
Created November 23, 2011 18:41
#!/bin/sh
emacsclient "$@"
if [[ $? -eq 1 ]]; then
/Applications/Emacs.app/Contents/MacOS/Emacs &
echo "Waiting for server socket to appear..."
until [[ -S "$TMPDIR/emacs$UID/server" ]]; do
sleep 0.5
done
emacsclient "$@"
fi
#Newbie programmer
def factorial(x)
if x == 0
return 1
else
return x * factorial(x - 1)
end
end
puts factorial(6)
require 'bindata'
module BlockSizeCalculator
def ciphertext_block_size(block_size)
block_size / CipherBlockSize +
(0 == block_size % CipherBlockSize ? 0 : 1) * CipherBlockSize +
CipherBlockSize
end
end
@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')
~ ❧ sudo gem install rubyforge
Password:
Successfully installed rubyforge-2.0.0
1 gem installed
Installing ri documentation for rubyforge-2.0.0...
Updating ri class cache with 6026 classes...
Installing RDoc documentation for rubyforge-2.0.0...
~ ❧ rubyforge config
/Library/Ruby/Gems/1.8/gems/json-1.1.9/lib/json/common.rb:122:in `parse': 618: unexpected token at '<?xml version="1.0" encoding="UTF-8"?> (JSON::ParserError)
kbullock@x-134-84-64-185 15:06:11
~ ❧ false
☹ kbullock@x-134-84-64-185 15:06:31
~ ❧ true
kbullock@x-134-84-64-185 15:10:41
~ ❧
# Adapted from <http://willcode4beer.com/tips.jsp?set=tabMaven>
_rake()
{
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local rake="$1"
if [[ ${cur} == -* ]] ; then # complete long options
local opts='--classic-namespace --describe --dry-run --execute \
--execute-print --execute-continue --libdir --prereqs --quiet --rakefile \