This file contains hidden or 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
"...if there's one thing I've learned from Rails, it's to get the hell out of | |
the way and let people focus on the task at hand. | |
Reduce friction. | |
Newton's first law of motion, as commonly written, makes two statements: an | |
object at rest tends to stay at rest and an object in motion tends to stay in | |
motion. It's often referred to as the Law of Inertia. | |
And inertia, for those who don't remember or didn't take high school physics, |
This file contains hidden or 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
// source: http://camp.nodejs.org/videos/session-01_introduction_to_node-ryan_dahl.html | |
// Handles TCP connections | |
net = require('net'); | |
// define global variables | |
people = [] | |
// create tcp server | |
s = net.createServer(function(socket) { |
This file contains hidden or 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
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
add: function(trigger, behavior, handler) { | |
document.observe(trigger, function(event) { | |
var element = event.findElement("*[data-behaviors~=" + behavior + "]"); | |
if (element) handler(element, event); | |
}); |
This file contains hidden or 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
# layout_helper.rb | |
module LayoutHelper | |
def headjs | |
["/javascripts/jquery.js","/javascripts/rails.js","/javascripts/application.js"] | |
end | |
def headjs_show | |
"<script type='text/javascript'> | |
head.js('#{headjs.join('\',\'')}'); | |
</script>" |
This file contains hidden or 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 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
NewerOlder