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 'sinatra' | |
get '/' do | |
erb :index | |
end | |
get %r{/(services|faq|about).php} do | |
erb params[:captures].first.to_sym | |
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
mango:Ray bertrand$ ruby test_fibers.rb | |
test_fibers.rb:38: [BUG] Bus Error | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin11.2.0] | |
-- control frame ---------- | |
c:0014 p:---- s:0050 b:0050 l:000049 d:000049 CFUNC :resume | |
c:0013 p:0079 s:0047 b:0046 l:002078 d:001478 BLOCK test_fibers.rb:38 | |
c:0012 p:---- s:0044 b:0044 l:000043 d:000043 FINISH | |
c:0011 p:---- s:0042 b:0042 l:000041 d:000041 CFUNC :instance_exec | |
c:0010 p:0024 s:0039 b:0039 l:000038 d:000038 METHOD /Users/bertrand/.rvm/gems/ruby-1.9.2-p180/gems/ray-0.2.0/lib/ray/scene.rb:114 |
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 'spec_helper' | |
describe StaffplansController do | |
before(:each) do | |
@current_user = login_user | |
@company = Factory(:company) | |
@current_user.update_attributes(current_company_id: @company.id) | |
end | |
describe 'GET#show' 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
$ -> | |
$('div.client_selector select#project_client_id') | |
.change -> | |
if $(@).val() == "new" | |
$(@).closest('div.client_selector').append '<input id="client_name" name="client[name]" size="30" type="text">' |
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
Array.class_eval do | |
def extract! | |
if block_given? | |
[].tap do |rejects| | |
delete_if do |element| | |
yield(element) and rejects << element | |
end | |
end | |
else | |
self |
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
module StaffPlan::JsonSerializer | |
def serialize(*args) | |
options = args.extract_options! | |
if args.first.is_a?(Array) or args.first.is_a?(ActiveRecord::Relation) | |
serialize_collection(args.first, options) | |
else | |
serialize_instance(args.first, options) | |
end | |
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
require 'spec_helper' | |
describe RegistrationsController do | |
describe "Forgetful user gets to the user page. He should have a forgot password link" do | |
it "should display a template containing the string t('sessions.new.forgot_password')" do | |
end | |
end | |
describe "User provides an email address" do | |
it "should display a page containg an appropriate text field and a submit button" 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
int | |
mbtowc(wchar_t *p, char *s, size_t n) | |
{ | |
long l; | |
int c0, c, nc; | |
Tab *t; | |
if(s == 0) | |
return 0; |
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
{ companies: [ | |
{ name: “company name” | |
, users: [ | |
{ id: 1 | |
, first_name: “rob” | |
, last_name: “sterner” | |
, project_ids: [1,2,3,4] | |
} | |
] | |
, projects: [ |
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
respond_to :json | |
def index | |
if params[:secret].eql? SOME_API_TOKEN | |
respond_with Company.all_with_users_and_projects | |
else | |
render { head :forbidden } and return | |
end | |
end |