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
# un-greppable delegate API | |
class Foo | |
delegate :qux, to: :bar, prefix: true | |
end | |
# possible fixes to the API to make it greppable | |
class Foo | |
delegate :bar_qux, to: :bar, prefixed: true |
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
def create | |
card = current_user.credit_cards.create(card_params) | |
if card.persisted? | |
render :success | |
else | |
render :failure | |
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
{ | |
"links":{ | |
"self":"/orders", | |
"link-docs":[ | |
{ | |
"name":"v1", | |
"href":"http://api.example.com/docs/v1/{link}", | |
"templated":true | |
} | |
], |
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
dir structure: | |
/lib/ | |
/tmp/ | |
/views/ | |
/public/ | |
/config.ru | |
/blog.rb | |
-- |
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
/* | |
I want to be able to build a DSL for node.js so that I can define app routes for an HTTP interface like this: | |
*/ | |
{ | |
"/blog" : { | |
GET: function(request) { | |
// List blog posts | |
}, |
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
#(entry point) | |
> GET / | |
< 200 OK | |
< Link: </lists/some-list>; rel="http://example.com/rels/list", | |
< </foobars/another-list>; rel="http://example.com/rels/list" | |
< {...} | |
<html> | |
<head> |
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
(GET /list) | |
<link rel="self" href="/list"> | |
<link rel="description" href="/list/description" /> | |
<link rel="search" href="/list/search/{search_term}" /> | |
<created_at>2010-01-16</created_at> | |
<updated_at>2010-02-21</updated_at> | |
<summary>An example list</summary> | |
<link rel="owner" href="/people/mike"> | |
<name>Mike</name> |
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
# Critical default settings: | |
disable_system_gems | |
disable_rubygems | |
bundle_path '.gems/bundler_gems' | |
# List gems to bundle here: | |
gem 'rails_dm_datastore' | |
gem 'rails', "2.3.5" | |
# Needed for Devise-Plugin |
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
// (/app/resources/useraccount.js) | |
Resource({ | |
respond_to: ["html", "xml", "json"], | |
http: { | |
GET: function() { | |
user = User.find(params.user); | |
respond_with(user); | |
}, | |
PUT: function() { |
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
<resource rel="self" href="/list"> | |
<resource rel="description" href="/list/description" /> | |
<resource rel="search" href="/list/search/{search_term}" /> | |
<created_at>2010-01-16</created_at> | |
<updated_at>2010-02-21</updated_at> | |
<summary>An example list</summary> | |
<resource rel="owner" href="/people/mike"> | |
<name>Mike</name> | |
<age>36</age> | |
</resource> |
OlderNewer