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
| # 32 bit | |
| url="http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-i686/en-US/" | |
| # 64 bit | |
| url="http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/" | |
| index=`wget -q -O - $url` | |
| file=`echo $index | tr '\n' ' ' | sed 's/.*\(firefox-[0-9]*[\.0-9]*.tar.bz2\).*/\1/'` | |
| wget -O firefox.tar.bz2 "$url""$file" | |
| bzip2 -cd firefox.tar.bz2 | tar xvf - |
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
| self: 570, | |
| tabs: 332, | |
| widget: 330, | |
| page-mod: 196, | |
| panel: 179, | |
| context-menu: 163, | |
| request: 130, | |
| simple-storage: 75, | |
| notifications: 70, | |
| selection: 69, |
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
| let bookmarks = [b1, b2, b3]; | |
| // Emitter | |
| save(bookmarks).on('data', (bookmark) => { | |
| // a bookmark saved | |
| }).on('end', (bookmarks) => { | |
| // all bookmarks finished | |
| }); | |
| // Promise with one input |
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
| # From https://github.com/kripken/emscripten/wiki/Tutorial | |
| cd ~/ | |
| curl http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-apple-darwin11.tar.gz > llvm.tgz | |
| tar xzvf llvm.tgz | |
| ln -s clang+llvm-3.2-x86_64-apple-darwin11 llvm | |
| git clone git://github.com/kripken/emscripten.git | |
| cd emscripten | |
| LLVM=~/llvm/bin ./emcc | |
| LLVM=~/llvm/bin ./emcc tests/hello_world.cpp |
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 | |
| emcc sin.cpp -o sin.js \ | |
| -s EXPORTED_FUNCTIONS="['_Sin_constructor','_Sin_destructor','_Sin_setFrequency','_Sin_setAmplitude','_Sin_getFrequency','_Sin_computeBuffer']" | |
| cat sin-proxy.js >> sin.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
| let { events, on, off, once } = require('sdk/places/events'); | |
| on('bookmark-added', ({ type, target, data }) => { | |
| console.log(type); // 'bookmark-added' | |
| console.log(target); // undefined; | |
| console.log(data); // [Object object] | |
| }); | |
| // or |
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
| self.port.emit('message', 'hi!'); | |
| self.port.on('messageSuccess', function (msg) { | |
| console.log('my message is', msg); | |
| }); | |
| self.port.on('key', function (key) { | |
| console.log('my key is', key); | |
| }); |
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
| let { EventTarget } = require('sdk/event/target'); | |
| let { pipe } = require('sdk/event/utils'); | |
| let { on, emit } = require('sdk/event/core'); | |
| let from = EventTarget(); | |
| let to = EventTarget(); | |
| pipe(from, to); | |
| on(to, 'testevent', x => console.log("****")); | |
| emit(from, 'testevent', 'blah'); |
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
| /** | |
| * Opens/closes windows using either Jetpack wrappers (`USE_JETPACK`) or using the `windowWatcher`. | |
| * Either way, does not reclaim memory in: | |
| * explicit -> window-objects -> top(none)/detached/window([system]) | |
| */ | |
| let { Cc, Ci } = require('chrome'); | |
| let WW = Cc['@mozilla.org/embedcomp/window-watcher;1'].getService(Ci.nsIWindowWatcher); | |
| let { open } = require('sdk/window/utils'); | |
| let { setInterval, clearInterval } = require('sdk/timers'); | |
| let URI = 'chrome://browser/content/browser.xul'; |
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 TYPES = ['sine', 'sawtooth','triangle', 'square']; | |
| var ctx = new (window.AudioContext || window.webkitAudioContext)(); | |
| var osc = ctx.createOscillator(); | |
| var t = 0; | |
| osc.connect(ctx.destination); | |
| osc.start(0); | |
| setInterval(function () { osc.type = TYPES[t++ % TYPES.length]; }, 1000) |