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
background.html | |
=============== | |
// Bounce all requests back to the tab they came from | |
chrome.extension.onRequest.addListener(function (request, sender, sendResponse) { | |
chrome.tabs.sendRequest(sender.tab.id, request, sendResponse); | |
}); |
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
view.html (iframe) | |
================== | |
chrome.extension.sendRequest({ | |
to: 'overlord', | |
method: 'startDrag', | |
params: { | |
x: mousedown_event.screenX, | |
y: mousedown_event.screenY | |
} | |
}); |
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
overlord.js (content script) | |
============================ | |
/** | |
* Adds event listeners to the window to detect mousemoves and moves the iframe | |
* corespondingly. | |
*/ | |
IframeOverlord.prototype.startDrag = function(params) { | |
var overlord = this; | |
// location of click inside iframe |
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 domTest = require('./lib/domtest'); | |
var testDocumentExists = function (window) { | |
assert.notEqual(window.document, undefined); | |
}; | |
var testJQueryVersion = function (versionString) { | |
return function (window) { | |
assert.notEqual(window.jQuery, undefined); | |
assert.strictEqual(window.jQuery.fn.jquery, versionString); |
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
> try { poop() } catch (e) {console.trace(e.stack) } | |
Trace: ReferenceError: poop is not defined | |
at [object Context]:1:7 | |
at Interface.<anonymous> (repl:98:19) | |
at Interface.emit (events:27:15) | |
at Interface._ttyWrite (readline:295:12) | |
at Interface.write (readline:132:30) | |
at Stream.<anonymous> (repl:79:9) | |
at Stream.emit (events:27:15) | |
at IOWatcher.callback (net:489:16) |
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 jerk = require('jerk'); | |
var options = { | |
server: 'iriecycle.net', | |
port: 6600, | |
nick: 'walnuts', | |
user: { | |
username: 'walnuts', | |
hostname: 'walnuts', | |
realname: 'walnuts', |
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
exports.asyncFor = function (start, end, eachCallback, endCallback) { | |
var helper = function (i) { | |
if (i >= end) { | |
return process.nextTick(function () {endCallback();}); | |
} | |
eachCallback(i); | |
process.nextTick(function () {helper (i+1);}); | |
}; | |
return helper(start); |
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
<script id="message" type="text/html"> | |
<div class="message {{ type }}" id="{{ cssID }}"> | |
<time datetime="{{ time }}">{{ humanTime }}</time> | |
<span class="name {{#isYou}} current-user {{/isYou}}"> | |
{{ author }}: | |
</span> | |
<span class="body">{{ content }}</span> |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>CHAT</title> | |
<script src="/javascripts/lib/jquery.js"></script> | |
<script src="/javascripts/lib/jquery.scrollto.js"></script> |
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
spire.subscribe('spire.io chat example', {orderBy: 'asc'}, function (messages) { | |
// We want the oldest message at the top. | |
messages.reverse(); | |
$(messages).each(function(i, rawMessage){ | |
var message = rawMessage.content | |
, date = new Date(rawMessage.timestamp) | |
, mentionedRegex = new RegExp([ '(^|\\s|\\t)' | |
, currentUser | |
, '(\\s|\\t|:|-|,|$)' | |
].join(''), 'gi') |
OlderNewer