Skip to content

Instantly share code, notes, and snippets.

View dannysmith's full-sized avatar

Danny Smith dannysmith

View GitHub Profile
def test_me
puts test_me
end
@dannysmith
dannysmith / .bash_profile.sh
Created August 13, 2009 12:16
My .bash_profile
#This is the path variable for my current projects path. It changes as I change projects.
export CPPATH=~/code/rails/rwp
# Adds Macports and Git to PATH & MANPATH.
export MANPATH=/opt/local/share/man:$MANPATH
export PATH=/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:$PATH
#Sets SVN, GVS and default editors to Textmate
export EDITOR="mate -w"
export CVSEDITOR="mate -w"
@dannysmith
dannysmith / .irbrc.rb
Created August 26, 2009 10:26
My current .irbrc file.
require 'rubygems'
require 'pp'
require 'logger'
#Load Wribble (colouring etc in irb)
begin
require 'wirble'
Wirble.init
Wirble.colorize
set value to the name of (info for (path to frontmost application))
if value contains "." then
repeat until last character of value = "."
set total to count (character of value)
set value to characters 1 through (total - 1) of value as text
end repeat
set total to count (character of value)
set value to characters 1 through (total - 1) of value as text
end if
return value
<img src="${1:http://dummyimage.com/${2:250x400}/${3:555555}/${4:ffffff}.${5:png}${7:&amp;text=${6:placeholder+image}}}" alt="${8:Placeholder Image}" />
include Math
def myPi(reps)
inside = 0
reps.times do
inside += 1 if (Math.sqrt(rand**2+rand**2) < 1)
end
return (4*inside)/reps.to_f
end
class Person
attr_accessor :name, :height, :hair_color, :fatness
def initialize(name, height, hair, fatness)
self.name = name.capitalize
self.height = height.to_f
self.hair_color = hair.capitalize
self.fatness = fatness
end
loop do
print ">>"
output = eval($stdin.gets)
print "=>"
puts output.inspect
end
#Includes circle.rb in this file.
#require File.join(File.dirname(__FILE__), 'circle.rb')
require 'yaml'
#Prints the contents of the data part of the file.
a = DATA.readlines
b = YAML::load(DATA)
puts "-----"
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- According to Heather Champ, former community manager at flickr,
you should not allow search engines to index your "Contact Us"