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
alias serve="ruby -rwebrick -e\"s = WEBrick::HTTPServer.new(:Port => 8080, :DocumentRoot => Dir.pwd); trap('INT') {\ | |
s.shutdown }; s.start\"" |
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 'package) | |
(add-to-list 'package-archives | |
'("elpa" . "http://tromey.com/elpa/")) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/") t) | |
(package-initialize) |
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 simple reactor built on Java's channels, using JavaScript | |
to cut down on syntactic noise. | |
From the command line, just run: sprintstack server.js | |
To connect, use something like: nc localhost 8080 | |
This is purely for illustrative purposes: it does no error checking, | |
has inefficient bytebuffer / string / collection manipulation and many | |
other naughty things in the name of simplicity. |
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
#include <dispatch/dispatch.h> | |
#include <stdio.h> | |
int main() { | |
dispatch_queue_t queue = dispatch_queue_create(NULL, NULL); | |
dispatch_async(queue, ^{ | |
printf("Hello, world from a dispatch queue!\n"); | |
}); |
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 'foxbat' | |
require 'em-websocket' | |
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 3333, | |
:secure => true, :keystore => '/path/to/keystore') do |ws| | |
ws.onopen { | |
puts "WebSocket connection open" | |
# publish message to the client | |
ws.send "Hello Client" | |
} |
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 f = new future(function() { | |
return {"foo" : 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
var x = new actor(function(msg) { | |
console.log('Foo!'); | |
}); | |
x.send('something'); // => 'Foo!' | |
x.upgrade(function(msg) { | |
console.log('Bar!'); | |
}); |
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
// Shamelessly pulled from the Rubinius example | |
// at http://rubini.us/doc/en/systems/concurrency/ | |
var ping = new actor(function(msg) { | |
if (msg === 1000) { | |
console.log(msg); | |
} else { | |
pong.send(msg++); | |
} | |
}); |
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
package com.mowforth.rhinode; | |
public class MyClassLoader extends java.lang.ClassLoader { | |
public Class defineClass(byte[] b) { | |
return defineClass(null, b, 0, b.length); | |
} | |
} |
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
Exception in thread "main" java.lang.ClassCastException: org.mozilla.javascript.NativeClassyObject cannot be cast to org.mozilla.javascript.ScriptableObject | |
at org.mozilla.javascript.commonjs.module.Require.executeModuleScript(Require.java:314) | |
at org.mozilla.javascript.commonjs.module.Require.getExportedModuleInterface(Require.java:283) | |
at org.mozilla.javascript.commonjs.module.Require.call(Require.java:213) | |
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:98) | |
at org.mozilla.javascript.gen._stdin__1.call_script(Unknown Source) | |
at org.mozilla.javascript.gen._stdin__1.call(Unknown Source) | |
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:422) | |
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) | |
at org.mozilla.javascript.gen._stdin__1.call(Unknown Source) |