Skip to content

Instantly share code, notes, and snippets.

@stepahn
stepahn / .gitignore
Created April 22, 2010 13:00
a gitignore for rails
*#
*~
.#*
.DS_Store
.svn
db/*.sql*
db/schema.rb
log/*
tmp/*
test/*
@stepahn
stepahn / wheel o' food.rb
Created April 13, 2010 10:01
wheel 'o food
class Array; def rand; self[Kernel.rand self.length]; end; end
Array.new(rand(100)*2+1){[:pizza, :chinese, :greek].rand}.inject(Hash.new{0}){|h, i| h[i]+=1;h }
#!/bin/bash
DAY=$( date +%d)
BACKUP_DIR="/tehre/goes/the/backups"
mkdir -p ${BACKUP_DIR}
for i in /path/where/important/stuff/is/*
do
BASENAME=$(basename $i)
NAME="foo"
EMAIL="[email protected]"
git filter-branch -f --env-filter '
if [ "$GIT_AUTHOR_EMAIL" = "XXX" ];
then
export GIT_AUTHOR_NAME=$NAME
export GIT_AUTHOR_EMAIL=$EMAIL
export GIT_COMMITTER_NAME=$NAME
export GIT_COMMITTER_EMAIL=$EMAIL
class Array
def shuffle
self.sort_by { rand }
end
end
class Spinner
CHARS = %w{- \\ | / }
def initialize
@step=-1
end
def to_s
"\r#{char}"
end
<%= navigation [
:home, t(:'navigation.home'),
:gallery, t(:'navigation.gallery'),
:shop, t(:'navigation.shop'),
:contact, t(:'navigation.contact'),
:orders, t(:'navigation.orders'),
:products, t(:'navigation.products'),
:pages, t(:'navigation.pages'),
:pictures, t(:'navigation.pictures')], :link_text => true, :authorize => [:orders, :products, :pages, :pictures]%>
RedCloth.new(" *222 Something* I would expect to be just a little bit emphasized").to_html
=> "<strong>222 Something</strong> I would expect to be just a little bit emphasized
RedCloth.new("*222 Something* I would expect to be just a little bit emphasized").to_html
=> "<ul start=\"222\">\n\t<li>Something* I would expect to be just a little bit emphasized</li>\n</ul>"
require 'socket'
server = TCPServer.open(9999)
loop do
Thread.start(server.accept) do |client|
puts "connected #{client.inspect}"
begin
while say = client.readline.strip
puts "largetype: #{say}"
`osascript -e 'tell application "Quicksilver"
tell application "Quicksilver"
show large type "FAIL"
end tell