Skip to content

Instantly share code, notes, and snippets.

View SeanRoberts's full-sized avatar

Sean Roberts SeanRoberts

View GitHub Profile
class Invite
attr_accessor :csv
def initialize(csv)
@csv = csv
end
def import!
# your method
end
>> regex = %r{^[A-Za-z]?[0-9]+$}
>> "11209520".match(regex)
=> #<MatchData "11209520">
>> "A11209520".match(regex)
=> #<MatchData "A11209520">
>> "AA11209520".match(regex)
=> nil
/Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': no such file to load -- require_relative (LoadError)
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/seanroberts/Sites/factore/forge3/vendor/ruby/1.8/gems/linecache-0.45/lib/linecache.rb:66
from /Users/se
$.ajax({
url: '/forge/assets/' + id,
type: 'GET',
data: data,
success: function(data) {
// do the success stuff
},
error: function() { alert("There was a small error, you may need to refresh the page to see your new asset."); }
});
# config/thingy.yml
development:
key: SLKJSDFLKJDF
secret: SLKDJFSLKJLKJGLKJLKJGLKJDLKJLkj21l3k432lkj
test:
key: SLKJSDFLKJDF
secret: SLKDJFSLKJLKJGLKJLKJGLKJDLKJLkj21l3k432lkj
production:
key: SLKJSDFLKJDF
development:
s3:
key:
secret_key:
zencoder:
key:
secret_key:
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment.rb'
require 'daemons'
class DispatchDaemonFetcherDaemon < Daemon::Base
@config = YAML.load_file("#{Rails.root}/config/dispatch_daemon.yml")
@config = @config[Rails.env].to_options
@sleep_time = @config.delete(:sleep_time) || 60
require 'spec_helper'
describe 'As a search engine viewing a page' do
before do
visit "/"
end
it "should please just run this test" do
1.should == 1
end
task :parse_tournament_dates => :environment do
tournaments = Tournament.all
tournaments.each do |tournament|
dates = tournament.dates.split(' to ')
if dates.size == 2
begin
tournament.starts_on, tournament.ends_on = Time.parse(dates[0]), Time.parse(dates[1])
tournament.save
puts "Saved #{tournament.title} (#{tournament.starts_on}-#{tournament.ends_on})"
rescue
@mixin button($background_base, $height: 39px, $left-pad: 5, $padding: 15, $background_ext: '.png') {
display: inline-block;
background: image-url('buttons/left_#{$background_base}#{$background_ext}') no-repeat left top;
padding-left: $left-pad + px;
span {
display: block;
background: image-url('buttons/right_#{$background_base}#{$background_ext}') no-repeat right top;
height: $height;
padding-left: $padding - $left-pad + px;
padding-right: $padding + px;