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.prototype.unique = function() { | |
var uniqueKeys = {}, | |
uniqueArray = [], | |
items = this.length | |
while( items ) | |
uniqueKeys[this[--items]] = true | |
for( var key in uniqueKeys ) | |
if (uniqueKeys.hasOwnProperty(key)) uniqueArray.push(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
#!/usr/bin/env ruby -wKU | |
def ∑ *args | |
args.inject do |sum, x| | |
sum + x | |
end | |
end | |
puts ∑ 1, 2, 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
#!/usr/bin/env ruby -wKU | |
module Kernel | |
alias λ proc | |
def ∑ *terms | |
terms.inject { |sum, term| sum + term } | |
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
var DatabaseFactory = { | |
getInstanceById: function(id, type) { | |
if(!this.instances) this.instances = {}; | |
var theId = id + "" + typeof type; | |
if(this.instances[theId]) { | |
return this.instances[theId]; | |
} else { | |
this.instances[theId] = new type(id); | |
return this.instances[theId]; |
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
// Record Object | |
function Record(id) { | |
this.id = id; | |
} | |
Record.prototype.save = function() { | |
console.log("saving record " + this.id); | |
} | |
Record.prototype.delete = 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
// Record Object | |
function Record(id) { | |
this.id = id; | |
} | |
Record.prototype.save = function() { | |
console.log("saving record " + this.id); | |
} | |
Record.prototype.delete = 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
<!DOCTYPE html> | |
<script type="text/javascript"> | |
var http = (function () { | |
var PublicInterface = {} | |
function request (verb, uri, payload) { | |
var uri = uri || "/", | |
payload = payload || "" |
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
post_url failed to generate from {:controller=>"posts", :action=>"show", :locale=>#<Post id: 1, name: "abc", text: "test", created_at: "2010-06-07 14:30:17", updated_at: "2010-06-07 14:30:17">}, expected: {:controller=>"posts", :action=>"show"}, diff: {:locale=>#<Post id: 1, name: "abc", text: "test", created_at: "2010-06-07 14:30:17", updated_at: "2010-06-07 14:30:17">} |
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
format.xml { render :xml => @post } | |
format.plist { | |
send_data( | |
@post.to_plist, | |
:type => "application/plist", | |
:filename => "post-#{@post.id}.plist", | |
:disposition => 'inline' | |
) | |
} |
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 Jeena | |
def Jeena::tuwas | |
puts "klassenmethode" | |
end | |
def tuwas | |
puts "instanzmethode" | |
end | |
end |