Skip to content

Instantly share code, notes, and snippets.

View sintaxi's full-sized avatar
🔥
GSD

Brock Whitten sintaxi

🔥
GSD
View GitHub Profile
class Asset < ActiveRecord::Base
# Plugins
has_attachment :storage => :file_system,
:thumbnails => {
:large => '160x160!',
:med => '80x80!',
:small => '40x40!'
},
:max_size => 5.megabytes,
{
"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 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
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
<!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" />
require 'merb_helpers'
base = File.dirname(__FILE__)
module ActivityLogging
module Model
def self.included(base)
base.send(:include, InstanceMethods)
end
begin
require File.join(File.dirname(__FILE__), "gems/environment")
rescue LoadError
begin
require 'minigems'
rescue LoadError
require 'rubygems'
end
end
def hello_world(people)
people.each do |person|
"hello #{person.name}. have a good day"
end
end
require "rubygems"
require "dm-core"
require "dm-constraints"
DataMapper.setup(:default, {
:adapter => 'mysql',
:database => "constraint_test",
:username => 'root',
:password => '',
:host => '127.0.0.1',
def hello(x)
puts "hello #{x}"
end
alias :alias_hello :hello
def hello(x)
if x == "world"
alias_hello(x)
else