$ rails g model User
belongs_to
has_one
| require 'mongomapper' | |
| class Media | |
| include MongoMapper::EmbeddedDocument | |
| key :file, String | |
| end | |
| class Video < Media | |
| key :length, Integer | |
| end |
| # ... | |
| # append following lines | |
| Dir[ File.join(File.dirname(__FILE__), 'tasks', '*.rake') ].sort.each do |f| | |
| load f | |
| end |
| # Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler | |
| if defined?(::Bundler) | |
| $LOAD_PATH.concat Dir.glob("#{ENV['rvm_path']}/gems/#{ENV['rvm_ruby_string']}@global/gems/*/lib") | |
| end |
| #!/usr/bin/env ruby | |
| # Script to generate PDF cards suitable for planning poker | |
| # from Pivotal Tracker [http://www.pivotaltracker.com/] CSV export. | |
| # Inspired by Bryan Helmkamp's http://github.com/brynary/features2cards/ | |
| # Example output: http://img.skitch.com/20100522-d1kkhfu6yub7gpye97ikfuubi2.png | |
| require 'rubygems' |
| # https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html | |
| # https://www.varnish-cache.org/trac/wiki/VCLExamples | |
| # Summary | |
| # 1. Varnish will poll the backend at /health_check to make sure it is | |
| # healthy. If the backend goes down, varnish will server stale content | |
| # from the cache for up to 1 hour. | |
| # 2. Varnish will pass X-Forwarded-For headers through to the backend | |
| # 3. Varnish will remove cookies from urls that match static content file | |
| # extensions (jpg, gif, ...) |
| # Task: Implement the rcat utility and get these tests to pass on a system | |
| # which has the UNIX cat command present | |
| # To see Gregory Brown's solution, see http://github.com/elm-city-craftworks/rcat | |
| # Feel free to publicly share your own solutions | |
| rrequire "open3" | |
| working_dir = File.dirname(__FILE__) | |
| gettysburg_file = "#{working_dir}/data/gettysburg.txt" |
| config.model PagePart do | |
| edit do | |
| field :content, :text do | |
| ckeditor do | |
| true | |
| end | |
| end | |
| end | |
| end |
| /* =========================================================== | |
| * bootstrap-datepicker.js v1.3.0 | |
| * http://twitter.github.com/bootstrap/javascript.html#datepicker | |
| * =========================================================== | |
| * Copyright 2011 Twitter, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * |
| ######## | |
| # This file script wil show you how to install Ruby Enterprise Edition (REE) 1.8.7-2011-12 with | |
| # rbenv, rails 3 and homebrew. Bundler is also used. | |
| ######## | |
| #setup the installer environment | |
| brew install wget | |
| wget -q http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz | |
| tar xzf ruby-enterprise-1.8.7-2011.12.tar.gz |