Skip to content

Instantly share code, notes, and snippets.

Noitidart Noitidart

Block or report user

Report or block Noitidart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Noitidart / _ff-addon-snippet-xhrPromise.js
Last active Sep 18, 2016
_ff-addon-snippet-xhrPromise - A function that does XHR wrapped up in a promise. MAINTHREAD USE ONLY. Cannot use from Workers.
View _ff-addon-snippet-xhrPromise.js
// rev10 -
function xhrPromise(aUrlOrFileUri, aOptions={}) {
// does an async request
// aUrlOrFileUri is either a string of a FileURI such as `OS.Path.toFileURI(OS.Path.join(OS.Constants.Path.desktopDir, 'test.png'));` or a URL such as ``
// :note: When using XMLHttpRequest to access a file:// URL the request.status is not properly set to 200 to indicate success. In such cases, request.readyState == 4, request.status == 0 and request.response will evaluate to true.
// Returns a promise
// resolves with xhr object
// rejects with object holding property "xhr" which holds the xhr object
var aOptionsDefaults = {
luckyrat / gist:7803415810fb4c09c975
Created May 22, 2015
importGlobalProperties test JSM
View gist:7803415810fb4c09c975
// JSM for working out which globalproperties can be imported in a specific Firefox version.
// 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");
Integralist / flatten-array.js
Created May 20, 2015
Array flatten function written in ES6 syntax
View flatten-array.js
const flattenTco = ([first,], accumulator) =>
(first === undefined)
? accumulator
: (Array.isArray(first))
? flattenTco([...first,])
: flattenTco(rest, accumulator.concat(first))
const flatten = (n) => flattenTco(n, []);
Yoric / gist:c710b97dd55f98f8f0e3
Created Apr 20, 2015
Making a PromiseWorker that can shutdown
View gist:c710b97dd55f98f8f0e3
let myWorker = {
// Worker initialization
get worker() {
if (this._worker) {
return this._worker;
// Otherwise, initialize PromiseWorker.
Noitidart / _ff-addon-snippet-X11_XGetWindowProperty.js
Last active Aug 29, 2015
_ff-addon-snippet-X11_XGetWindowProperty - Shows how to use XGetWindowProperty, this is my skeleton for when I use it. [jsctypes] [x11] [unix]
View _ff-addon-snippet-X11_XGetWindowProperty.js
var nixtypesInit = function() {
// BASIC TYPES (ones that arent equal to something predefined by me)
this.ATOM = ctypes.unsigned_long;
this.BOOL =;
this.CHAR = ctypes.char;
this.GDKDRAWABLE = ctypes.StructType('GdkDrawable');
this.GDKWINDOW = ctypes.StructType('GdkWindow');
this.DATA = ctypes.voidptr_t;
abe33 /
Last active May 1, 2018
Scrolling Atom editors without moving the cursor
atom.commands.add 'atom-text-editor',
'editor:scroll-down': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
newScrollTop = editorElement.getScrollTop() + editorElement.getHeight()
'editor:scroll-up': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
alex-spataru / Opening files using system events in Qt
Last active Aug 29, 2015
Open files from system request on Mac [Qt]
View Opening files using system events in Qt
#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
lukewagner / ArrayBuffer.transfer
Created Nov 13, 2014
ArrayBuffer.transfer strawman
View ArrayBuffer.transfer
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
var buf1 = new ArrayBuffer(40);
View set-icon.js
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) {
kewisch / TracedRequest.js
Created Oct 2, 2014
Monitor all http(s) network requests using the Mozilla Platform
View TracedRequest.js
/* 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 */
var allRequests = [];
* Add the following function as a request observer:
* Services.obs.addObserver(httpObserver, "http-on-examine-response", false);
You can’t perform that action at this time.