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 iOS = require('iOS'); | |
iOS.createNotification({ | |
header: 'node-iOS Rocks!', | |
message: 'How much does running \'node\' on your iPhone rock?', | |
defaultButton: 'A lot!', | |
alternateButton: 'It rocks my socks' | |
}, function(err, res){ | |
if (err) throw err; | |
console.log(res); |
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
// To compile: | |
// gcc -o runLoop runLoop.m -framework Foundation -framework UIKit | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.h> | |
@interface AccelerometerDelegate: NSObject<UIAccelerometerDelegate> { | |
} | |
@end |
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
// To compile: | |
// gcc -o vib vib.c -F/System/Library/PrivateFrameworks -framework GraphicsServices | |
#import <GraphicsServices/GSEvent.h> | |
int main() { | |
GSEventVibrateForDuration(3.5f); | |
return 0; | |
} |
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
* | |
!*.m | |
!Makefile |
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 ffi = require('node-ffi') | |
, objc = new ffi.Library(null, { | |
'objc_getClass': [ 'pointer', [ 'string' ] ] | |
, 'class_getName': [ 'string', [ 'pointer' ] ] | |
, 'sel_registerName': [ 'pointer', [ 'string' ] ] | |
, 'sel_getName': [ 'string', [ 'pointer' ] ] | |
, 'objc_msgSend': [ 'pointer', [ 'pointer', 'pointer' ] ] | |
}) | |
// The problem with libffi and C functions that accepts varargs is that we | |
// have to create new wrappers for each different argument and return value |
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 $ = require('NodObjC') | |
// First you need to "load" the Framework | |
$.import('Foundation') | |
// Make the 'NSMutableArray' constructor be global | |
var NSMutableArray = $.NSMutableArray | |
// Now let's create an NSMutableArray | |
, array = NSMutableArray('alloc')('init') |
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
require('datejs'); | |
console.error(Date.CultureInfo); |
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 MixpanelLib = function (j, n, m) { | |
function k(a, c, b) { | |
if (a.length) { | |
var e; | |
for (e = 0; e < a.length; e++) c.call(b || c, a[e], e) | |
} else if (typeof a == "object") for (e in a) Object.hasOwnProperty.call(a, e) && c.call(b || c, a[e], e) | |
} | |
function z(a, c) { | |
a.prototype = new c; | |
a.prototype.constructor = a; |
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 xmlrpc = require('xmlrpc') | |
, parse = require('url').parse | |
, slice = Array.prototype.slice | |
function MetaWeblog (url) { | |
var parsed = parse(url) | |
, client = xmlrpc.createClient({ | |
host: parsed.hostname | |
, path: parsed.pathname | |
, port: parsed.port || 80 |
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 FFI = require("node-ffi"); | |
var CUSTOM_USER_DIRECTORY= "/Users/santiago/tmp"; | |
var Purple = new FFI.Library("/Users/santiago/tmp/lib/libpurple", { "purple_util_set_user_dir": [ "void", [ "string" ] ] }); | |
Purple.purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); |