Skip to content

Instantly share code, notes, and snippets.

View nlacasse's full-sized avatar

Nicolas Lacasse nlacasse

  • Los Angeles, CA
View GitHub Profile
> 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)
@nlacasse
nlacasse / gist:647622
Created October 26, 2010 19:44
i can make this happen
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);
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
view.html (iframe)
==================
chrome.extension.sendRequest({
to: 'overlord',
method: 'startDrag',
params: {
x: mousedown_event.screenX,
y: mousedown_event.screenY
}
});
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);
});