Skip to content

Instantly share code, notes, and snippets.

class User
include MongoMapper::Document
key :name, String
# etc
many :addresses
end
class Address
<?php
function returnimages($dirname="images") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
$files[] = $file;
}
closedir($handle);
// I write this
body.about #work, body.contact #work {
width: 500px;
}
// But to make it "LESS" style
body.about {
#work {
width: 500px;
}
22:14 ~ $ cd src
22:14 ~/src $ cd code
22:14 ~/src/code $ cd rails
22:14 ~/src/code/rails (master)$ sudo rake install
Password:
(in /Users/garrett/src/code/rails)
(in /Users/garrett/src/code/rails/activesupport)
(in /Users/garrett/src/code/rails/activemodel)
(in /Users/garrett/src/code/rails/actionpack)
(in /Users/garrett/src/code/rails/actionmailer)
@import "reset";
/**
* Wrapper
*/
#wrapper {
background: url('../images/content/wrap.gif') repeat-x top;
width: 805px;
margin: 0 auto; padding: 10px;
(function($) {
var cache = [];
$.preloadImages = function() {
$(arguments).each(function (i) {
cache.push($('<img>', { 'src': arguements[i] }));
});
}
})(jQuery);
# Use Bundler (preferred)
environment = File.expand_path('../../vendor/gems/environment', __FILE__)
if File.exist?("#{environment}.rb")
require environment
else
vendor_rails = File.expand_path('../../vendor/rails', __FILE__)
if File.exist?(vendor_rails)
Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) }
end
def post_process #:nodoc:
return if @queued_for_write[:original].nil?
# This line below causes the first line of fire_events to return true, which stops the post_process_styles
# I can't figure out what before_post_process does
return if fire_events(:before)
post_process_styles
return if fire_events(:after)
end
def fire_events(which) #:nodoc:
directory "/Users/garrett/src/sites/GB", :glob => "{*/,}*.gemspec"
git "git://github.com/rails/arel.git"
git "git://github.com/rails/rack.git"
gem "rails", :git => "git://github.com/rails/rails.git"
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git", :branch => "rails3"
gem "authlogic", :git => "git://github.com/binarylogic/authlogic.git"
directory "/Users/garrett/src/sites/GB", :glob => "{*/,}*.gemspec"
git "git://github.com/rails/arel.git"
git "git://github.com/rails/rack.git"
gem "rails", :git => "git://github.com/rails/rails.git"
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git", :branch => "rails3"
gem "authlogic", :git => "git://github.com/binarylogic/authlogic.git"