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
let addItem = handler() { Global.items.push(Local.text) } | |
let containerStyle = { padding: 5, margin: 5, border: '1px solid' } | |
<div style=containerStyle> | |
<input data=Global.foo /> | |
<br /> "Global.foo: " Global.foo | |
</div> | |
<div style=containerStyle> | |
"Add item with text: " <input data=Local.text /> |
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
<div class="rooms"> | |
<input data=Local.newRoomName /> | |
<button>"Create new room"</button onclick=handler() { | |
Global.rooms.unshift(new { name:Local.newRoomName, messages:[] }) | |
Local.newRoomName.set('') | |
}> | |
for room in Global.rooms { | |
<div class="room"> | |
<div class="name">room.name</div onclick=handler() { Local.currentRoom = room }> | |
</div> |
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
<div class="rooms"> | |
<input data=Local.newRoomName /> | |
<button>"Create new room"</button onclick=handler() { | |
Global.rooms.unshift(new { name:Local.newRoomName, messages:[] }) | |
Local.newRoomName.set('') | |
}> | |
for (room in Global.rooms) { | |
<div class="room"> | |
<div class="name">room.name</div onclick=handler() { Local.currentRoom = room }> | |
</div> |
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 Local | |
import Global | |
<div class="rooms"> | |
<input data=Local.newRoomName /> | |
<button>"Create new room"</button onclick=handler() { | |
let newRoom = new { name:Local.newRoomName, messages:[] } | |
Global.rooms.unshift(newRoom) | |
Local.newRoomName.set('') | |
}> |
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
# The embed code is compressed and minified using the closure compiler. | |
# Please run ./compile to build the embed code. | |
# | |
# Lines starting with #<space> will be removed during compilation. | |
# Lines starting with #<A> will be included only for target A. | |
# A line can be included in multiple targets if the target names | |
# are separated with '|', e.g. #spacebook|myface alert('hello'); | |
/** | |
* If the code is included twice, the second instance will not adversely |
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('soda').createSauceClient({ 'username': 'username-string', 'access-key': 'access-key-string', | |
'url': 'http://example.saucelabs.com/', 'max-duration': 300, | |
'os': 'Windows 2003', 'browser': 'firefox', 'browser-version': '3.6', | |
'name': 'This is an example test' }).chain.session() | |
.open('/') | |
.getTitle(function(title){ | |
require('assert').ok(~title.indexOf('Cross browser testing with Selenium - Sauce Labs'), 'Title did not include the query'); | |
}) | |
.testComplete() | |
.end(function(err){ |
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 textEl = document.createElement('div'), | |
container = document.createElement('div'), | |
lineHeight = 25 // pixels of a single line | |
container.appendChild(textEl) | |
function showText(text) { | |
// hide the text while we test its layout. visibility='hidden' still keeps the element in the DOM, in contrast to display='none' | |
textEl.style.visibility = 'hidden' | |
textEl.innerHTML = text | |
textEl.style.textAlign = (textEl.offsetHeight > lineHeight | |
? 'left' // overflowing onto two lines |
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 port = 8080 | |
require('require/server').mount(require('http').createServer(function(req, res) { | |
if (req.url == '/') { | |
res.end('<body><script src="/require/little_client"></script></body>') | |
} | |
}), { port:port }).listen(port) |
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 raphael = require('raphael') | |
var paper = raphael(100, 100, 200, 200), | |
circle = paper.circle(100, 100, 100) | |
circle.attr("fill", "#f00") | |
circle.attr("stroke", "#fff") |
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
mkdir app | |
cd app | |
echo '{ "name":"app" }' > package.json | |
sudo npm install require | |
sudo npm install raphael | |
curl -O https://gist.github.com/raw/975866/little_server.js | |
curl -O https://gist.github.com/raw/975868/little_client.js | |
node little_server.js |
OlderNewer