This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PS1="\u@\h:\w$ " | |
export CLICOLOR=1 | |
export LSCOLORS=gxFxCxDxBxegedabagacad | |
export EDITOR='mate -w' | |
export PATH="/usr/local/bin:$PATH" | |
alias l='ls -al' | |
alias svdc='svn diff | mate' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<link href="reset.css" media="screen" rel="stylesheet" type="text/css" /> | |
<style types="text/css" media="all"> | |
/* Left these in here in case you want to fiddle some more with it */ | |
ul#movie-list { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssoper@caprica:~$ irb | |
irb(main):001:0> class Person | |
irb(main):002:1> def initialize | |
irb(main):003:2> @@cool = true | |
irb(main):004:2> end | |
irb(main):005:1> def cool? | |
irb(main):006:2> @@cool | |
irb(main):007:2> end | |
irb(main):008:1> def cool=(cool) | |
irb(main):009:2> @@cool = cool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
// Based on Paul Barry's Tail-Call Optimized odds calculator | |
// http://paulbarry.com/articles/2009/08/30/tail-call-optimization | |
int main(int argc, char *argv[]) | |
{ | |
__block double (^odds1)(int, int, double); | |
odds1 = ^(int n, int p, double acc) { | |
if (n == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using ruby to cleanup any pesky X instances | |
require 'fileutils' | |
Dir.glob('/tmp/xvfb-run.*').each do |entry| | |
pid = entry[/\d{3,5}$/].to_i rescue nil | |
next unless pid | |
Process.kill("TERM", pid) rescue Errno::ESRCH | |
FileUtils.rm_rf(entry) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Throw this in your config/initializers dir for some hot tag cloud action using the is_taggable gem | |
module TaggableExtensions | |
def tag_cloud | |
result = self.find_by_sql <<-SQL | |
SELECT tags.id as tag_id, tags.name as tag_name, count(taggings.tag_id) as tag_count | |
FROM tags, taggings | |
WHERE tags.id = taggings.tag_id AND taggings.taggable_type = "#{self}" | |
GROUP BY (taggings.tag_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = [] | |
while 1 == 1 | |
d << rand(1000) | |
puts d.last | |
end | |
results = {} | |
total = d.length.to_f | |
9.times do |x| | |
lower = x * 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# output from clipboard directly to file | |
sudo sh -c "pbpaste > file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def concat_with_utf8(other_or_fixnum) | |
if other_or_fixnum.respond_to?(:force_encoding) | |
result = other_or_fixnum.force_encoding(Encoding::UTF_8) | |
else | |
result = other_or_fixnum | |
end | |
concat_without_utf8(result) | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if RUBY_VERSION >= "1.9" | |
require 'csv' | |
FasterCSV = CSV | |
else | |
require 'fastercsv' | |
end |