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 nowjs = require("now"); | |
var everyone; | |
var node_static = require('node-static'); | |
// | |
// Create a node-static server instance to serve the './client' folder | |
// | |
var node_static_file = new(node_static.Server)('./client'); | |
var server = require('http').createServer(function (req, res) { | |
req.addListener('end', function () { |
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 node_static = require('node-static'); | |
var node_static_file = new(node_static.Server)('./client'); | |
var http = require('http'), | |
players = {}, | |
server = http.createServer(function(req, res) { | |
// static file server | |
req.addListener('end', function () { | |
node_static_file.serve(req, res); | |
}); | |
}).listen(80); |
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
[ | |
{ | |
"type": "help", | |
"helpvalue": "<h4>Tabbed Array Example</h4><p>Tab arrays can have tabs to the left, top or right.</p>" | |
}, | |
{ | |
"key": "fe", | |
"type": "tabarray", | |
"add": "New", | |
"remove": "Delete", |
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
import Color exposing (..) | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
dots = 50 | |
main : Element | |
main = | |
collage 150 150 (List.map shape [0..dots-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
import Graphics.Element exposing (show) | |
graph = {nodes=[{id=1, name="test1"}, {id=2, name="test2"}], | |
edges=[{from=2, to=1, e_type="get"}, {from=2, to=1, e_type="set"}, {from=1, to=2, e_type="get"}]} | |
main = | |
show (edgesTo graph.edges 1, edgesToOf graph.edges 1 "get") | |
edgesTo : List { a | to : Int } -> Int -> Int | |
edgesTo list nodeId = | |
case list of |
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> | |
<html> | |
<body> | |
<p>Close this window, press F5 or click on the link below to invoke the beforeunload event.</p> | |
<p>The problem is that we cannot tell the difference between unload and reload</p> | |
<a href="http://www.google.com">Click here to go to google.com</a> | |
<div id="count">0</div> | |
<script> |
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
import {run} from '@cycle/xstream-run'; | |
import {makeDOMDriver, div, button} from '@cycle/dom'; | |
import _ from 'lodash'; | |
import xs from 'xstream'; | |
function main ({DOM}) { | |
const add$ = DOM | |
.select('.add') | |
.events('click') |
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
import {run} from '@cycle/xstream-run'; | |
import {makeDOMDriver, div, button} from '@cycle/dom'; | |
//import _ from 'lodash'; | |
import sampleCombine from 'xstream/extra/sampleCombine' | |
import xs from 'xstream'; | |
function main ({DOM}) { | |
const inc = (c) => c+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
// a definition of 'map' | |
{ | |
local-words:{ | |
map-repeat: [dup 0 > [1 - swap dup dip2 swap map-repeat] [drop drop drop r get [drop] dip] if-else ] | |
map-package: [{} swap f set swap o set [] r set] | |
} | |
fn:[map-package | |
[o get dup str-length 0 > [pop [f get] dip2 2 bubble-up apply [o set] dip [r get ] dip prepend r set] if] | |
[dup [apply] dip] [o get str-length] dip2 2 bubble-up map-repeat | |
] |
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
# simply updates a poperty in a map | |
[[dup] dip [get] dip2 dip set] [update] def | |
{u:6} u [1 +] update | |
{x:1 y:2} x [1 +] update y [1 -] update | |
OlderNewer