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
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); |
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 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); | |
* |
Alright then, lets start with copy array a
into b
, by reusing and modifying memset
.
function memcpy(dst, src, size) {
for (var i = 0; i < size; ++i) {
dst[i] = src[i];
}
}
Now, thats nice, but does not actually make sure that the arrays have the same CType
, better add a check for that.
A multi-level groupBy for arrays inspired by D3's nest operator.
Nesting allows elements in an array to be grouped into a hierarchical tree
structure; think of it like the GROUP BY
operator in SQL, except you can have
multiple levels of grouping, and the resulting output is a tree rather than a
flat table. The levels in the tree are specified by key functions.
See this fiddle for live demo.
(function(){ | |
Components.utils.import('resource://gre/modules/ctypes.jsm'); | |
var library = ctypes.open(ctypes.libraryName('nss3')); | |
var PR_Free = library.declare( | |
'PR_Free', | |
ctypes.default_abi, | |
ctypes.void_t, | |
ctypes.voidptr_t | |
); | |
var ptr = new ctypes.voidptr_t(0123); |
This is a bookmarklet that adds a fully functional Fork button to your own Gist.
If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.
The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well).
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; |