This file contains hidden or 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
Rx.Observable.asStream = function (ev) { | |
return Rx.Observable.create(function (obs) { | |
function handler (data) { | |
obs.onNext(data); // Call as many times with onNext to yield new data | |
// obs.onCompleted(); // optional to signal the end of the stream | |
} | |
ev.on('data', handler); |
This file contains hidden or 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
<html> | |
<body style="background: #333"> | |
<script > | |
var gui = require('nw.gui'); | |
var win = gui.Window.get(); | |
function takeSnapshot() { | |
win.capturePage(function(img) { | |
var popWindow = gui.Window.open('popup.html', | |
{width: 420, height: 300}); | |
popWindow.on('loaded', function() { |
This file contains hidden or 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
[submodule "color"] | |
path = color | |
url = https://github.com/kamicane/mootools-color | |
[submodule "lsd-specs"] | |
path = lsd-specs | |
url = https://github.com/lovelyscalabledrawings/lsd-specs | |
[submodule "lsd"] | |
path = lsd | |
url = https://github.com/lovelyscalabledrawings/lsd | |
[submodule "Sheet.js"] |
This file contains hidden or 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
#!/bin/bash | |
rm -rf t | |
while true | |
do | |
read packet | |
echo $packet >> t | |
cnt=`echo $packet | wc -c` | |
if [ $cnt == 2 ] #end of message | |
then | |
key=`cat t | grep "Sec-WebSocket-Key:" | cut -f2 -d " "` |
This file contains hidden or 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
/* | |
* Copyright (C) 2008 Apple Inc. All Rights Reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* 2. Redistributions in binary form must reproduce the above copyright | |
* notice, this list of conditions and the following disclaimer in the |
This file contains hidden or 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/O Patch implementation in C | |
// | |
// A patch has strongly defined inputs and outputs, which can be connected to other | |
// patches' outputs and inputs to form program flow. A patch implements user code | |
// which reads zero or more immutable input values and mutates zero or more output | |
// values. This user code is implemented as conceptually pure functions (although | |
// the user is able to break pureness). | |
// | |
// Build and run: |
This file contains hidden or 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
d = d || document.createElement('div'); | |
var id = n.id; | |
do { | |
do { | |
d.appendChild(n); | |
d.innerHTML = ''; | |
} while (n.parentNode); | |
} while (n = document.getElementById(id)); |
This file contains hidden or 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 two = 2, four = 4, five = 5; | |
exports: function sum(x, y) { | |
return x + y; | |
} | |
exports: var pi = 3.141593, birthday = 12; | |
exports: two, four; |
This file contains hidden or 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
// Does this look familiar? A grid of dependent checkboxes. | |
// [ ] Select all | |
// [ ] Option 1 | |
// [ ] Option 2 | |
// [ ] Option 3 | |
// [ ] Option 4 | |
// [ ] Select all |
This file contains hidden or 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
### | |
The indentation on a line following a statement creates an implicit variable. | |
That variable can be reused by placing more statements on the same whitespace level. | |
### | |
createElement 'a' | |
.style | |
.width = 100 | |
.height = 100 | |
.setAttribute 'href', 'http://...' |