Skip to content

Instantly share code, notes, and snippets.

View Gozala's full-sized avatar
😱
Oh well

Irakli Gozalishvili Gozala

😱
Oh well
View GitHub Profile
@Gozala
Gozala / README.md
Created October 27, 2009 20:30 — forked from Gozala/meta-docs.patch
metadocs

Idea of documenting js code inspired by python and EcmaScript 5 "strict mode"; Works on narwhal, firefox, chromium, safari (not tested on ie)

Below is the example of usage in this in the the shell

gozala@ijarti:~/Projects/meta-doc  (master)$ narwhal
Rhino 1.7 release 3 PRERELEASE 2009 04 05
js> require("meta-doc/toolkit").doc()
toolkit module
provides utilities for getting a live docs
// Here is a proposal for minimalist JavaScript classes(?), that does not
// introduces any additional syntax to the language, instead it standardizes
// approach already used by majority of JS frameworks today.
// !!! What is a PROBLEM!!!
function Dog(name) {
// Classes are for creating instances, calling them without `new` changes
// behavior, which in majority cases you need to handle, so you end up with
// additional boilerplate.
@Gozala
Gozala / javascript_background_thread.js
Created September 19, 2012 01:53 — forked from jameswomack/javascript_background_thread.js
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@Gozala
Gozala / sdk_strawman.js
Created October 10, 2012 11:01 — forked from jeffgca/sdk_strawman.js
content script apis ideas
// Content scripts will be able to require modules, only
// high level ones that are E10S friendly and can do
// everything via data that is serialize.
$(function() {
// what we have now
self.on('event-name', function(data) {
// ... something
});
self.port.emit('something');
@Gozala
Gozala / derp-modules.js
Created October 11, 2012 08:56 — forked from gordonbrander/derp-modules.js
Simple, tiny, dumb JavaScript Modules
(function(exports) {
// Simple, tiny, dumb module definitions for Browser JavaScript.
//
// What it does:
//
// * Tiny enough to include anywhere. Intended as a shim for delivering
// browser builds of your library to folks who don't want to use script loaders.
// * Exports modules to `__modules__`, a namespace on the global object.
// This is an improvement over typical browser code, which pollutes the
// global object.
@Gozala
Gozala / case.js
Created November 6, 2012 00:23 — forked from isaacs/case.js
npm testcase
var npm = require("npm")
var path = require("path")
npm.load({ prefix: path.join(process.env.HOME, ".orchestrator") }, function(e, npm) {
npm.commands.ls([], function(err, _) {
// this time it's nothing but probably results are cached
npm.commands.install(["method"], function(err, _) {
// now there is something but it still thinks there is nothing.
npm.commands.ls([], console.log)
})
@Gozala
Gozala / iframe.js
Created December 11, 2012 21:55 — forked from anonymous/iframe.js
Updated version
let { Cc, Ci } = require('chrome');
let appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
getService(Ci.nsIAppShellService);
let service = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
let window = appShellService.hiddenDOMWindow;
let document = window.document;
let XUL = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'
@Gozala
Gozala / gist:4637925
Last active December 11, 2015 17:58 — forked from fitzgen/gist:4637923
var obj = {
_discoverScriptsAndSources: function TA__discoverScriptsAndSources() {
let scriptsAdded = [];
for (let s of this.dbg.findScripts()) {
if (!this._allowSource(s.url)) {
continue;
}
scriptsAdded.push(this._addScript(s));
@Gozala
Gozala / tweets.js
Last active December 15, 2015 16:59 — forked from jcoglan/tweets.js
// This is in response to https://gist.github.com/Peeja/5284697.
// Peeja wanted to know how to convert some callback-based code to functional
// style using promises.
var Promise = require('rsvp').Promise;
var ids = [1,2,3,4,5,6];
// If this were synchronous, we'd simply write:
@Gozala
Gozala / API-Overview.md
Last active December 16, 2015 06:29 — forked from ZER0/gist:5209412
Direct page to add-on communication

Consider following example where:

A - addon

B - evil.com

  • C - good.com

Related material