Skip to content

Instantly share code, notes, and snippets.

require 'rspec'
class Node
attr_accessor :next
attr_reader :name
def initialize(name)
@name = name
end
class Node
attr_accessor :next, :name
end
a = Node.new
b = Node.new
c = Node.new
a.next = b
b.next = c
@jsl
jsl / gist:3221297
Created July 31, 2012 22:36
Removing and re-installing all bottles after mountain lion upgrade
for bottle in `brew list` ; do brew remove $bottle && brew install $bottle ; done
@jsl
jsl / gist:3153360
Created July 20, 2012 21:27
Advanced Ruby Talk at EAFIT by Justin Leitgeb
I'm giving a talk on Ruby at EAFIT in Medellin next week! Below are the details:
Fecha: Martes 24 de julio
Hora: 6:00 a 7:00 PM
Lugar:27-103
It's open to the public, but if you're not with the university tweet me and I'll forward your name to the University so that you can be put on the list for security.
My cell phone is 320-652-4001, call me if you have any problems getting in or questions about the event and I'll see what I can do to help. You can also tweet @justinleitgeb with any questions or comments.
(ns euler.p8)
(defn ones-digit-of
[number]
(mod number 10))
(defn shift-digit-from
[number]
(/ (- number (ones-digit-of number)) 10))
fsync = false
full_page_writes = false
bgwriter_lru_maxpages = 0
autovacuum = off
@jsl
jsl / gist:2429938
Created April 20, 2012 16:07
Rspec test
require 'rspec'
module Dog
def self.bark
"Woof!"
end
end
describe "Rspec re-setting stubs on classes" do
it "should return 'Woof!'" do
justin ~/Code/atea $ lein clean
justin ~/Code/atea $ lein deps
Copying 4 files to /Users/justin/Code/atea/lib
Copying 2 files to /Users/justin/Code/atea/lib/dev
justin ~/Code/atea $ lein native-deps
WARNING: lancet namespace is deprecated; use lancet.core.
[WARNING] POM for 'org.clojars.pka:jdic-macos-tray:pom:0.0.2:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
Expanding: /Users/justin/.m2/repository/org/clojars/pka/jdic-macos-tray/0.0.2/jdic-macos-tray-0.0.2.jar into /Users/justin/Code/atea
@jsl
jsl / gist:1775007
Created February 8, 2012 22:38
Hacked SubTestTask that allows exit status to be returned after failing tests
module Rails
# Don't abort when tests fail; move on the next test task.
# Silence the default description to cut down on `rake -T` noise.
class SubTestTask < Rake::TestTask
# Create the tasks defined by this task lib.
def define
lib_path = @libs.join(File::PATH_SEPARATOR)
task @name do
puts "running sub test task #{@name}"
run_code = ''
for i in `git br -r | grep -v master | sed 's/origin\///'` ; do git push origin :$i ; sleep 1 ; done