This file contains 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
/** | |
* TypeScript single-file compiler: | |
* | |
* $ node tsc-single-file.js < input.ts > output.js | |
* | |
* Avoids TypeScript attempting to compile an entire "project", | |
* so that a proper `make` target can be written. | |
*/ |
This file contains 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
macro assert { | |
rule {($test ...)} => { | |
if (!($test ...)) { | |
throw new Error('AssertionError: ' + #{ $test ... }); | |
} | |
} | |
} | |
var foo = 100; |
This file contains 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 utility = ffi.Library('utility', { | |
'tesJson': ['void', ['string']] | |
}); | |
var obj = {'1': 'one', '2': 'two'}; | |
utility.tesJson(JSON.stringify(obj)); |
This file contains 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
/* Compile: | |
* Unix/OSX: gcc -o test test.c -ldl | |
* Windows via dlfcn-win32: cl.exe /I dlfcn-win32 dlfcn-win32\dlfcn.c test.c /Fetest.exe | |
*/ | |
#include <dlfcn.h> | |
#include <stdio.h> | |
int main () { | |
void *handle, *symbol; |
This file contains 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
<script src="wpcom.js"></script> | |
<script> | |
// create a client WPCOM instance | |
var wpcom = WPCOM(); | |
// retrieve a listing of the most recent | |
// 5 posts on "en.blog.wordpress.com" | |
wpcom | |
.site('en.blog.wordpress.com') | |
.postsList({ number: 5 }, function(err, data) { |
This file contains 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 $ = require('NodObjC'); | |
$.import('Cocoa'); | |
var installNSBundleHook = function() { | |
var cls = $.NSBundle; | |
if (cls) { | |
var bundleIdentifier = cls.getInstanceMethod('bundleIdentifier'); | |
bundleIdentifier.setImplementation(function(val) { |
This file contains 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
#!/usr/bin/env node | |
/** | |
* A little script to play the ASCII Star Wars, but with a hidden cursor, | |
* since over `telnet(1)` the cursor remains visible which is annoying. | |
*/ | |
process.title = 'starwars' | |
var net = require('net') |
This file contains 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 vm = require('vm'); | |
var pathCode = process.binding('natives').path; | |
var sandbox = { | |
process: { | |
env: process.env, | |
cwd: process.cwd, | |
platform: 'win32' | |
}, | |
require: require, |
This file contains 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 exec = require('child_process').exec; | |
var suspend = require('suspend'); | |
var resume = suspend.resume; | |
suspend.run(function*(){ | |
// first determine the list of npm usernames to sync up to | |
var npmUsers = process.argv.slice(2); |
This file contains 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
HTTP 33749: agent.request { agent: | |
{ domain: null, | |
_events: {}, | |
_maxListeners: undefined, | |
callback: [Function: connect], | |
secureProxy: true, | |
secureEndpoint: true, | |
proxy: | |
{ protocol: 'https:', | |
slashes: true, |