1,582 karma · joined August 16, 2010
guardArgs = (def, args) ->
i = 0
for arg, type of def
throw new Error("bad type of #{arg}") unless typeof args[i] == type
i++
typeEnsure = (def, f) -> ->
guardArgs(def, arguments)
f.apply @, arguments
myFunc = typeEnsure {name: 'string', i: 'number'}, (name, i) ->
console.log name, i
myFunc("foo", 1) # ok
myFunc("foo", "x") # Error: bad type of i
I think this can be extended to custom types too.Take Shazaam for example, who built an empire on audio data indexing/search, sound recognition = numerical analysis + probabilities + statistics + search algorithms + a lot of knowledge about systems architecture, distributed systems, databases etc.
Of course you can build products a la 37signals but is a lot more to software than that (and also note that 37 guys are not code monkeys/script kiddies/you-name-it, they actually know lots about CS - sample here: https://github.com/rails/acts_as_nested_set/blob/master /lib/active_record/acts/nested_set.rb )
At some point in your career you'll want to: write a parser, search a graph, optimize some storage thingie ...
Epilogue:
http://steve-yegge.blogspot.com/2007/06/rich-programmer-food...
function echo_r($x){
echo '<pre>';
print_r($x);
echo '</pre>';
}David Flanagan, JavaScript: The Definitive Guide
Crockford, Javascript the good parts
J Resig, Secrets if javascript ninja
J Resig, Pro JavaScript Techniques
* in firebug / web inspector
* qunit, jasmine etc
repl for node
### REPL ###
repl = require 'repl'
r = repl.start 'REPL> '
r.context.client = -> exec("open http://localhost:# {config.port}/") ; returnThe only thing that holds it back is the learning curve, wich is strange, because behind it is just plain rails philosophy: controller methods + views with a tasty DSL to plug them together.
A big thanks to Volker for his huge work on pushing it to rails3 compatibility.
The current rails3 branch (Volker's) it very stable.
What remains to be done to make it even more awesome is:
* use nested_attributes_for and clean the custom nested attrs logic
* clean security layer witch at the moment uses gobals (and can only be used in shared nothing deploy)
* request local configuration copy to make it more runtimeasible, at the moment it uses a class var (global-ish) that, for some customisations, needs to be altered per request, and that again leads to only-shared-nothing-deploy
* ActiveModel API so Mongoid can join the fun too
* a child gem that bundles AS to make a fully featured admin interface, competing with rails_admin & friends.
Further more, it's good at solving any problem since it's Turing complete.
To use it in Java I'd say one would embed an interpreter and provide an API for accessing Java logic, or use a bridge.
http://www.planeterlang.org/en/planet/article/A_comparison_b...
I highly recommend the rails guides: http://guides.rubyonrails.org/