inside this file is a webserver that will output the text "LinkedList NYC" on network port 31337 via HTTP.
executes with ruby 1.9.3
| /* | |
| * JavaScript variables are always passed by value. This works as you | |
| * expect it to when you pass primitives to functions. | |
| */ | |
| function add1(x) { | |
| // We get passed a copy of x's value -- which is a number -- so we can't | |
| // update the original variable's value | |
| x++; | |
| } |
| (define (ntbf-eval | |
| x h d) (unless (null? x) (case | |
| (car x) ((#\>) (ntbf-eval (cdr x) h | |
| (+ d 1))) ((#\<) (ntbf-eval (cdr x) h | |
| (- d 1))) ((#\+) (begin (vector-set! h d | |
| (+ 1 (vector-ref h d))) (ntbf-eval (cdr x) | |
| h d))) ((#\-) (begin (vector-set! h d (- | |
| 1 (vector-ref h d))) (ntbf-eval (cdr x) | |
| h d))) ((#\.) (begin (format #t "~a" ( | |
| integer->char (vector-ref h d))) (ntbf-eval |
| <html> | |
| <head> | |
| <script> | |
| function makeClosure () { | |
| var str = "This string was closed over"; | |
| return function () { | |
| console.log(str); | |
| }; | |
| }; | |
| // When you create a new object | |
| var obj = {data: "some data here"}; | |
| /* The JavaScript runtime environment allocates memory for you. | |
| __________________________ | |
| Your computer's memory ----> || Location || Value || | |
| ||------------------------|| | |
| It has to store that obj is || 0 || 2424 || | |
| an object, that it has a || 1 || 1002 || | |
| property named data, and || 2 || 327871 || |
| // New is a function that takes a function F | |
| function New (F) { | |
| var o = {}; // and creates a new object o | |
| o.__proto__ = F.prototype // and sets o.__proto__ to be F's prototype | |
| // New returns a function that... | |
| return function () { | |
| F.apply(o, arguments); // runs F with o as "this", passing along any arguments | |
| return o; // and returns o, the new object we created | |
| } |
| REGISTRY = {} | |
| function sub (name, cb, ctx) { | |
| if (typeof REGISTRY[name] === "undefined") { | |
| REGISTRY[name] = []; | |
| } | |
| return REGISTRY[name].push({cb: cb, ctx: ctx || null}); | |
| } | |
| function pub (name) { |
| The 2012 Programming Languages Day will be held at the IBM Thomas J. | |
| Watson Research Center on Thursday, June 28, 2012. The day will be held in | |
| cooperation with the New Jersey and New England Programming Languages and | |
| Systems Seminars. The main goal of the event is to increase awareness of | |
| each other's work, and to encourage interaction and collaboration. | |
| The Programming Languages Day features a keynote presentation and 8 | |
| regular presentations. Dr. Shriram Krishnamurthi of Brown University | |
| will deliver the keynote presentation this year, "Securing JavaScript | |
| on the Web". Details of the program are below. |
| function generate_math_operator(op) { | |
| return function(args) { | |
| var res = args[0], i, tmp; | |
| for (i=1; i<args.length; i++) { | |
| tmp = predicates.is_object(op) ? ast_to_js(op) : op; | |
| res += " " + tmp + " " + args[i]; | |
| } | |
| return res; | |
| }; | |
| } |
| // TODO: IE support if I feel like it; make fade length directly configurable | |
| (function() { | |
| var DELTA = 0.06, // how much to change opacity each step | |
| DURATION = 40; // how long in ms to pause between steps | |
| function fadeFunc(direction, start, end) { | |
| return function(el) { | |
| el = typeof(el) == 'object' ? el : document.getElementById(el); | |
| var step = function step() { | |
| var opacity = el.style.opacity; | |
| opacity = opacity === "" ? start : parseFloat(opacity); |