Skip to content

Instantly share code, notes, and snippets.

Avatar

Drew Olson drewolson

View GitHub Profile
@drewolson
drewolson / pipe.rb
Created Dec 23, 2008
pipe blog post example
View pipe.rb
require 'rubygems'
require 'sinatra'
require 'pipe'
get '/' do
Pipe.create do
feed "http://news.ycombinator.com/rss", :title => /ruby/i
feed "http://www.reddit.com/r/programming/.rss", :title => /clojure/i
end
end
View file layout
.
|-- Capfile
|-- Rakefile
|-- config.ru
|-- drewolson.rb
|-- public
| |-- favicon.ico
| |-- images
| | |-- aboutme.gif
| | |-- home.gif
View test_helper.rb
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'..')))
require 'rubygems'
require 'shoulda'
require 'mocha'
require 'sinatra'
require 'sinatra/test/unit'
set :views, File.expand_path(File.join(File.dirname(__FILE__),'..','views'))
View config.ru
require 'rubygems'
gem 'sinatra', '=0.3.2'
require 'sinatra'
ROOT_DIR = File.expand_path(File.dirname(__FILE__))
Sinatra::Application.default_options.merge!(
:views => File.join(ROOT_DIR, 'views'),
:app_file => File.join(ROOT_DIR, 'drewolson.rb'),
:run => false
View Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
set :application, "yourserver.com"
set :user, "someuser"
set :repository, "git@yourserver.com:reponame"
set :checkout, :export
set :deploy_to, "/home/#{user}/public_html/#{application}"
set :deploy_via, :remote_cache
View virtual host
<VirtualHost *:80>
ServerName yourserver.com
ServerAlias www.yourserver.com
DocumentRoot /home/someuser/public_html/yourserver.com/current/public
</VirtualHost>
View install ruby_focused_unit_test
git clone git://github.com/drewolson/ruby_focused_unit_test_vim.git
cp ruby_focused_unit_test/ruby_focused_unit_test.vim ~/.vim/plugin/
View ruby_mappings.vim
map <silent> <LocalLeader>rb :RunAllRubyTests<CR>
map <silent> <LocalLeader>rc :RunRubyFocusedContext<CR>
map <silent> <LocalLeader>rf :RunRubyFocusedUnitTest<CR>
View smushing_paul_grahams_scheduler.clj
; Simulates the manager's schedule within the maker's
; See http://www.paulgraham.com/makersschedule.html
(defn schedule_meeting [day]
(let [last (or (find_last_meeting day) (+ 1_hour (end_of day)))]
(schedule_meeting_at (1_hour_before last))))
View cruise_config.rb
Project.configure do |project|
case project.name
when 'fbolt_quick' then
project.build_command = 'RAILS_ENV=test rake ci:quick'
when 'fbolt_staging_deploy' then
project.triggered_by = [SuccessfulBuildTrigger.new(project, 'fbolt_quick')]
project.build_command = 'echo "Eventually I will deploy!!"'
when 'fbolt_browser' then
project.build_command = 'RAILS_ENV=test rake ci:browser'
else raise "Don't know what to build for project #{project.name.inspect}"