var runtime = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULRuntime); var abi = runtime.OS + "_" + runtime.XPCOMABI; var lib_name; this.data_loc = ""; //================================================================== // Detect shared library name to load
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
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
var allRequests = []; | |
/** | |
* Add the following function as a request observer: | |
* Services.obs.addObserver(httpObserver, "http-on-examine-response", false); | |
* |
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 x11 = require('x11'); | |
var PNG = require('png-js'); | |
var bl = require('bl'); | |
require('child_process').exec('locate png | grep 48').stdout.pipe(bl(function(err, files) { | |
var pngNames = files.toString().split('\n'); | |
var pngIndex = 0; | |
x11.createClient(function(err, display) { |
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
Proposal | |
-------- | |
The proposal is to add a static ArrayBuffer.transfer(oldBuffer [, newByteLength]). This | |
method returns a new ArrayBuffer whose contents are taken from oldBuffer.[[ArrayBufferData]] | |
and then either truncated or zero-extended to be newByteLength. This operation leaves | |
oldBuffer in a detached state. If newByteLength is undefined, oldBuffer.byteLength is | |
used. | |
var buf1 = new ArrayBuffer(40); |
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
#include <QEvent> | |
#include <QApplication> | |
// Create a subclass of QApplication so that we can customize what we | |
// do when the operating system sends us an event (such as opening a file) | |
class MyApp : public QApplication | |
{ | |
Q_OBJECT | |
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
atom.commands.add 'atom-text-editor', | |
'editor:scroll-down': -> | |
editor = atom.workspace.getActiveTextEditor() | |
editorElement = atom.views.getView(editor) | |
newScrollTop = editorElement.getScrollTop() + editorElement.getHeight() | |
editorElement.setScrollTop(newScrollTop) | |
'editor:scroll-up': -> | |
editor = atom.workspace.getActiveTextEditor() | |
editorElement = atom.views.getView(editor) |
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
Cu.import('resource://gre/modules/ctypes.jsm'); | |
var nixtypesInit = function() { | |
// BASIC TYPES (ones that arent equal to something predefined by me) | |
this.ATOM = ctypes.unsigned_long; | |
this.BOOL = ctypes.int; | |
this.CHAR = ctypes.char; | |
this.GDKDRAWABLE = ctypes.StructType('GdkDrawable'); | |
this.GDKWINDOW = ctypes.StructType('GdkWindow'); | |
this.DATA = ctypes.voidptr_t; |
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 myWorker = { | |
// | |
// Worker initialization | |
// | |
get worker() { | |
if (this._worker) { | |
return this._worker; | |
} | |
// Otherwise, initialize PromiseWorker. | |
// TODO |
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
const flattenTco = ([first, ...rest], accumulator) => | |
(first === undefined) | |
? accumulator | |
: (Array.isArray(first)) | |
? flattenTco([...first, ...rest]) | |
: flattenTco(rest, accumulator.concat(first)) | |
const flatten = (n) => flattenTco(n, []); | |
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]])) |
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
// JSM for working out which globalproperties can be imported in a specific Firefox version. | |
// https://developer.mozilla.org/en-US/docs/Components.utils.importGlobalProperties | |
// I'm not certain availability always equates to functionality but it probably does | |
// and in any case it's a way to narrow down the more involved test for functionality of each property | |
// Run from browser toolbox scratchpad like: | |
// Components.utils.import("resource://test-importGlobalProperties-addon/test.jsm"); | |
Components.utils.import("resource://gre/modules/devtools/Console.jsm"); |