I hereby claim:
- I am robi42 on github.
- I am robi42 (https://keybase.io/robi42) on keybase.
- I have a public key ASCuBTF2Vf86jtTHHPaGy7KAlORSqX0Zeq-KCCY1F8o5zgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
$ ringo | |
>> list = new ScriptableList(new java.util.HashSet(["foo", "bar", "bar"])) | |
[java.util.ArrayList [foo, bar]] | |
>> list[0] | |
'foo' | |
>> list.pop() | |
'bar' | |
>> map = new ScriptableMap(new java.util.HashMap({foo: 'bar'})) | |
{ foo: 'bar' } | |
>> map.foo |
$ ringo | |
>> list = java.util.Arrays.asList("foo", "bar", "baz") | |
[java.util.Arrays$ArrayList [foo, bar, baz]] | |
>> array = [_ for (_ in Iterator(list))] | |
[ 'foo', 'bar', 'baz' ] |
class Respond extends Service[Request, Response] with Logger { | |
def apply(request: Request) = { | |
try { | |
request.method -> Path(request.path) match { | |
case GET -> Root / "todos" => Future.value { | |
val data = Todos.allAsJson | |
debug("data: %s" format data) | |
Responses.json(data, acceptsGzip(request)) | |
} | |
case GET -> Root / "todos" / id => Future.value { |
var {Application} = require('stick'); | |
var response = require('ringo/jsgi/response'); | |
var app = exports.app = Application(); | |
app.configure('notfound', 'error', 'params', 'route'); | |
app.get('/', function (req) { | |
return response.json(req.params); | |
}); |
$ wget --no-check-certificate https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js | |
$ ringo --optlevel -1 | |
>> fs = require('fs') | |
>> coffee = fs.read('./coffee-script.js').replace(/this\.CoffeeScript/, 'exports.CoffeeScript') | |
>> fs.write('./coffee-script.js', coffee) | |
>> var {CoffeeScript} = require('./coffee-script') | |
>> code = CoffeeScript.compile("do -> 'Hello, Ringo world!'", {bare: true}) | |
'(function() { | |
return \'Hello, Ringo world!\'; | |
})();' |
{JFrame, JButton} = javax.swing | |
main = -> | |
frame = new JFrame('Hello World!') | |
button = new JButton('Bye bye') | |
button.addActionListener (e) -> | |
system.exit(); return | |
frame.add 'Center', button | |
frame.setSize 300, 300 | |
frame.visible = true |
exports.app = (req) -> | |
status: 200 | |
headers: | |
'Content-Type': 'text/plain' | |
body: ['Hello World!'] | |
if require.main is module | |
require('ringo/httpserver').main module.id |
$ ringo | |
>> set = new java.util.HashSet(['foo', 'bar']) | |
[java.util.HashSet [foo, bar]] | |
>> for each (var element in Iterator(set)) print(element) | |
foo | |
bar | |
>> |
(function (win) { | |
win.$mp = win.$mp || {}; | |
win.$mp.makeMvcPipe = function () { | |
var _loadStyleSheet = function (path, media, fn, scope) { | |
var sheet, cssRules; | |
var head = document.getElementsByTagName('head')[0]; | |
var link = document.createElement('link'); |