This file contains 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
#!/usr/bin/perl | |
#fetch Gravatars | |
use strict; | |
use warnings; | |
use LWP::Simple; | |
use Digest::MD5 qw(md5_hex); | |
my $size = 90; |
This file contains 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 "twitter" | |
require "json" | |
# things you must configure | |
TWITTER_USER = "your_username" | |
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted | |
# get these from dev.twitter.com | |
CONSUMER_KEY = "your_consumer_key" |
This file contains 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 FoodFightPlayCommandsController < LoggedInController | |
def create | |
command = FoodFightPlayCommand.new(params[:food_fight_play_command]) | |
command.person_id = current_person.id | |
# Set up success / failure callbacks | |
command.on_success = method(:on_success) | |
command.on_failure = method(:on_failure) | |
command.execute! | |
end |
This file contains 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
ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../') unless defined?(ENGINE_RAILS_ROOT) | |
def setup_environment | |
# Configure Rails Environment | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'capybara/rspec' |
This file contains 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
guard 'rspec', :version => 2 do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { "spec" } | |
# Rails example | |
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } | |
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } | |
watch(%r{^spec/support/(.+)\.rb$}) { "spec" } |
This file contains 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
#!/usr/bin/env ruby | |
# Migrate local Refinery images & resources to S3. | |
# Assumes you've set up an AWS::S3 connection | |
# elsewhere (I have an initializer that does it). | |
image_classes = [Image] | |
data_classes = [Resource] | |
def upload(path, file, bucket, retries = 3) |
This file contains 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
Refinery::Pages.configure do | |
types do | |
define :home do | |
self.parts = %w[intro body] | |
self.template = 'refinery/pages/home' # this is automatic but shows overriding | |
end | |
define :show do | |
self.parts = %w[body side] | |
# self.template is automatically 'refinery/pages/show' and thus not required. |
This file contains 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
Refinery::Core::Engine.routes.draw do | |
# frontend | |
namespace :blog do | |
root :to => "posts#index" | |
resources :posts | |
end | |
# backend | |
namespace :blog, :path => "" do |
This file contains 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 will help you trace .yml file which containts Psych::SyntaxError | |
require "rubygems" | |
require "psych" | |
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
# specify your locales folder in Dir.glob("*") with relative path from this file | |
Dir.glob("*").sort.each do |file| | |
begin |
This file contains 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
location / { | |
try_files /system/maintenance.html $uri $uri/index.html $uri.html @passenger; | |
expires 60s; | |
add_header Cache-Control public; | |
add_header Vary Accept-Encoding; | |
} |