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
#these are different!!! | |
(1..10).each do |i| | |
if i < 5 | |
puts i | |
else | |
break | |
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
i=0 | |
10.times{ ++i ; puts i} |
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
HOST = null; // localhost | |
PORT = 80; //run it as root, numb-nuts!!! | |
sys = require("sys"); | |
createServer = require("http").createServer; | |
readFile = require("fs").readFile; | |
url = require("url"); | |
function Connection(request, response){ |
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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Test</title> | |
</head> | |
<body id="test"> | |
<script> | |
function jaredsCreate(){ |
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 NodeSession = function(id, params, channels) { | |
sys.puts(sys.inspect([id, params, channels])); | |
this.session_id = id; | |
this.creationParams = params; | |
this.channels = channels; | |
this.outboundQueue = []; | |
var self = this; | |
this.receiveMessage = function(channel, data) { | |
self.receiveMessageUnbound(channel, data); |
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
%a{href:"##{controller}"}= controller | |
:if action && action !== 'index' | |
> |
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
/** | |
* Showing with the Express framwork http://expressjs.com/ | |
* Express must be installed for this sample to work | |
* npm install express | |
* npm install tropo-webapi | |
*/ | |
var tropoapi = require('tropo-webapi'); | |
var express = require('express'); | |
var app = express.createServer(); |
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
//Various settings. | |
var Client = require('mysql').Client; | |
client = new Client(); | |
TEST_DATABASE = 't_voice'; | |
TEST_TABLE = 't_calls'; | |
client.host = 'database.domain.com'; | |
client.user = 'auser'; | |
client.password = 'apassword'; | |
client.connect(); | |
client.query('USE '+TEST_DATABASE); |
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 redis = require("redis"), | |
client = redis.createClient(); | |
client.auto_sha = true; /* enable transparent sha1 cache and retry of all calls to eval */ | |
client.eval("return 1;", 0, function(err, num){..}); | |
/* checks client.auto_sha and will then look up sha in redis.sha1cache, | |
failing that will sha1 the script and cache it. | |
Perform the evalsha with an auto-fallback to eval if redis returns sha1 not found. |
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
require 'rubygems' | |
require 'tach' | |
Tach.meter(1_000_000) do | |
tach('double') do | |
"path" | |
end | |
tach('single') do | |
'path' | |
end |