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
View memmove.md

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.

View ctypes notes.md
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) {
@alex-spataru
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
{
Q_OBJECT
@Noitidart
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
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;
@Yoric
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.
// TODO
@luckyrat
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.
// 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");
@kewisch
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 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);
*
@milin
milin / django.test.client import proble,
Created Jan 28, 2011
django.test.client import Client gives django_settings_module not specified problem
View django.test.client import proble,
import django
import httplib2
import time,urlparse,urllib
from django.conf import settings
import oauth2 as oauth
from django.test.client import Client
@piroor
piroor / crash-with-crashreport.js
Last active Dec 31, 2015
Crash firefox by js-ctypes (run in the scratch pad or the browser console)
View crash-with-crashreport.js
(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);
You can’t perform that action at this time.