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 foo | |
a = 3 | |
{ | |
b = something | |
hello(b) | |
} | |
{ | |
c = something else |
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
reloadRecords: function() { | |
SC.Request.getUrl('/yoururl').json() | |
.notify(this, '_didRetrieve') | |
.send(); | |
}, | |
_didRetrieve:function(response) { | |
if(!SC.ok(response)) { | |
console.log('Unable to retrieve record'); |
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
// In my appcontroller | |
var c = [[MainViewController alloc] init]; | |
[[c view] setFrame:CGRectMake(0, 0, [contentView frame].size.width, [contentView frame].size.height)]; | |
[contentView addSubview:[c view]]; | |
// In my mainviewcontroller | |
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
SELECT *, coalesce(bool_or((select owner or write from privileges where (group_id = 2 or group_id in (select from_id from links where to_id = 2)) and target_type = 'Person' and target_id = people.id)), false) as writable FROM "people" |
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 get_id(m) | |
m.id | |
end | |
code(:super_id, :if => lambda {|m| get_id(m) == 453} ) do |m| | |
get_id(m) | |
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
has_many :medias, :dependent => :delete_all | |
has_one :template, :through => :medias |
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
enumerator = self.dynamo_db_table.items.query(options) | |
# this enumerator returns some proxy objects and can be used like so | |
enumerator.each do |item| | |
# do something with item, convert it into real item | |
data = item.attributes.to_h | |
obj = self.new(:shard => table) | |
obj.send(:hydrate, id, data) | |
# Now do something with obj |
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
create table nodes (int id, int parent_id); | |
insert into nodes (1, null); | |
insert into nodes (2, null); | |
insert into nodes (3, 1); | |
insert into nodes (4, 2); | |
insert into nodes (5, 4); | |
How can I do a query like this (on PostgreSQL 9.1): |
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
┌─(~/Projects/GithubForks/cappuccino/Foundation)────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(2012-07-11 17:13:19)─(kuon@aiur)─ | |
└─(node *)─> touch CPArray/* | |
┌─(~/Projects/GithubForks/cappuccino/Foundation)────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(2012-07-11 17:13:30)─(kuon@aiur)─ | |
└─(node )─> time jake | |
[CPP] _CPJavaScriptArray.j | |
[OBJJC] _CPJavaScriptArray.j | |
[CPP] CPArray.j | |
[OBJJC] CPArray.j | |
[CPP] CPMutableArray.j | |
[OBJJC] CPMutableArray.j |
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
resources :users do | |
put 'parents/:parent_id', :action => 'add_parent', :as => 'parents' | |
delete 'parents/:parent_id', :action => 'remove_parent' | |
end |