Skip to content

Instantly share code, notes, and snippets.

View steveklabnik's full-sized avatar
🦀
Rustacean

Steve Klabnik steveklabnik

🦀
Rustacean
View GitHub Profile
@steveklabnik
steveklabnik / template.html
Created July 9, 2011 23:35
I always end up typing out the minimal (for me) html5 stuff. so here it is.
<!doctype html >
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<nav></nav>
</body>
</html>
@steveklabnik
steveklabnik / quality.rake
Created July 11, 2011 20:18
My new favorite Rake task
require 'flog'
require 'flog_task'
require 'flay'
require 'flay_task'
require 'roodi'
require 'roodi_task'
FlogTask.new :flog, SOME_NUMBER_HERE, %w[app lib]
FlayTask.new :flay, OTHER_NUMBER_HERE, %w[app lib]
RoodiTask.new 'roodi', ['app/**/*.rb', 'lib/**/*.rb']
@steveklabnik
steveklabnik / dump.txt
Created August 2, 2011 20:21
This is a chrome dump.
Data exported on: Tue Aug 02 2011 16:21:01 GMT-0400 (EDT)
Number of passively captured events: 0
Number of actively captured events: 337
Chrome version: 13.0.782.107 (Official Build 94237) beta
Command line: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome -psn_0_2224671 --flag-switches-begin --flag-switches-end
Default address family: ADDRESS_FAMILY_IPV4
(IPv6 disabled)
@steveklabnik
steveklabnik / id_rsa.pub
Created August 4, 2011 14:59
My public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3aDjbNGbIh8hLiF9XQxLFYmzSTi4Qx/PFk+8icd1/iIBlxEAT1Z/nJVeAnbmvaGAZuFkWOX9PYp6+1Ry2eWRzmaUMaEgPxLBSNzCXhpzqy1OXsA+SQYuH1B7vweLOosz+jpd5p/JRixiBS7pz1mQh7yvGb1VEgphDGRAmMMKVqazj1GW0IZITJAQX4tAV8P+WdYvyGXggsBpDtURJw0ZSRJrAJRYOISlAwSDK6J+IJAFv0YkGYV1tl1yyyp/f5AbN7gdzK2C1Q0hiKQH4QoMJe7OmG4wXRBvWC0o7SiVwyBO27nL+yi3HGSXPmRol8sVjNq5j3dVXPkX9SMKBe78Vw== [email protected]
@steveklabnik
steveklabnik / duck_typing.rb
Created August 13, 2011 03:12
Duck typing!
class Something
def hey
"hello"
end
end
class OtherThing
def hey
"hi"
end
@steveklabnik
steveklabnik / ghost.rb
Created September 1, 2011 01:00
ghost methods!
class Student
def method_missing(name, *args, &blk)
"Sorry, I don't understand '#{name}'!"
end
end
s = Student.new
s.no_idea #=> "Sorry, I don't understand 'no_idea'!"
t = Student.new
t.no_idea #=> "Sorry, I don't understand 'no_idea'!"
@steveklabnik
steveklabnik / after.rb
Created September 5, 2011 16:43
dont load rails!
require 'active_record'
require "#{Rails.root}/app/models/user"
describe User do
it "does something sweet"
it "does something cool"
end
@steveklabnik
steveklabnik / id_rsa.pub
Created September 16, 2011 20:30
My Windows Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxQoMCRo/WpxABlczICpoqI7Xqvj1ozpqy05RYnF/55b/CSPVx9Af/7tgg2Abr9ARVZBugDqUZgOh1/c1Qn2UfC71vzEXNQ20V4zVD9h0H5oNHMQ8jk7zY03LCpKN/C+hnipPorZJdRCEWWjdY+jTZaUDG8Q7WGFvyNuD9EzFzyap2YXAJ16fq8re+nB0cKhUk9uiBrBfjAkMdxBdQFgckC15a0hbVe8wZ/a04DdL8Yu+ZftKMbQWmQLBj/L1ruR4ub6TMH1qOgtWMQh5WGQCTfHLVxQ1yV2/L8H7NrO+I7oaWcOFlnDO4AaXTc6ALTYmTXQjHd/qLP8mWgSoaVMhNQ== wintermute@WINTERMUTE-PC
@steveklabnik
steveklabnik / config.ru
Created September 20, 2011 22:24
A little router
class Router
def initialize
@route_list = {:get => {}, :post => {}, :put => {}, :delete => {}}
end
def add_route(method, route, &blk)
@route_list[method][route] = blk
end
def call(env)
@steveklabnik
steveklabnik / .vimrc.excerpt
Created November 18, 2011 23:19
RSpec vimrc
" run our spec files
function! RunSpecs()
let spec = matchstr(expand("%:r"), '_spec$')
if empty(spec)
return "spec/".expand("%:r")."_spec.rb"
else
return expand("%")
endif
endfunction