This file contains hidden or 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 Asset < ActiveRecord::Base | |
# Plugins | |
has_attachment :storage => :file_system, | |
:thumbnails => { | |
:large => '160x160!', | |
:med => '80x80!', | |
:small => '40x40!' | |
}, | |
:max_size => 5.megabytes, |
This file contains hidden or 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
{ | |
"announcements": { | |
"notice": "Drinks tonight at Alibi room. 9:00pm", | |
"alert": "urgent - looking for a DIV to VGA cable in room 201" | |
}, | |
"details": { | |
"when": "Thursday June 11 - Friday June 12th 2009", | |
"where": "Vancouver Convention & Exhibition Centre (VCEC)", | |
"geolocation": "49.314324,-123.107815", |
This file contains hidden or 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
# This is a script to install both ruby 1.8.7 and 1.9.1, with suffixed binaries and symlinks | |
mkdir -p /usr/local/src ; cd /usr/local/src | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p160.tar.bz2 | |
tar -xjvf ruby-1.8.7-p160.tar.bz2 | |
cd ruby-1.8.7-p160 | |
./configure --prefix=/usr --program-suffix=18 --enable-shared | |
make && sudo make all install | |
cd /usr/local/src |
This file contains hidden or 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
def str2binb(str) | |
bin = [] | |
mask = (1 << $chrsz) - 1 | |
#for(var i = 0; i < str.length * $chrsz; i += $chrsz) | |
i = 0 | |
while(i < str.length * $chrsz) | |
bin[i>>5] ||= 0 | |
bin[i>>5] |= (str[i / $chrsz] & mask) << (32 - $chrsz - i%32) | |
i += $chrsz | |
end |
This file contains hidden or 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 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Presentations | {{ page.title }}</title> | |
<meta name="author" content="Brock Whitten" /> | |
<!-- <link rel="stylesheet" href="/css/syntax.css" type="text/css" /> --> | |
<link rel="stylesheet" href="/css/presentation.css" type="text/css" media="screen, projection" /> |
This file contains hidden or 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
require 'merb_helpers' | |
base = File.dirname(__FILE__) | |
module ActivityLogging | |
module Model | |
def self.included(base) | |
base.send(:include, InstanceMethods) | |
end |
This file contains hidden or 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
begin | |
require File.join(File.dirname(__FILE__), "gems/environment") | |
rescue LoadError | |
begin | |
require 'minigems' | |
rescue LoadError | |
require 'rubygems' | |
end | |
end |
This file contains hidden or 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
def hello_world(people) | |
people.each do |person| | |
"hello #{person.name}. have a good day" | |
end | |
end |
This file contains hidden or 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
require "rubygems" | |
require "dm-core" | |
require "dm-constraints" | |
DataMapper.setup(:default, { | |
:adapter => 'mysql', | |
:database => "constraint_test", | |
:username => 'root', | |
:password => '', | |
:host => '127.0.0.1', |
This file contains hidden or 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
def hello(x) | |
puts "hello #{x}" | |
end | |
alias :alias_hello :hello | |
def hello(x) | |
if x == "world" | |
alias_hello(x) | |
else |