Skip to content

Instantly share code, notes, and snippets.

@bang590
bang590 / invokeVariableParameterMethod.m
Last active March 2, 2016 11:36
JSPatch invokeVariableParameterMethod() expand
if([argumentsList count] == 1) {
results = new_msgSend1(sender, selector, getArgument([argumentsList objectAtIndex:0]));
} else if([argumentsList count] == 2) {
if(numberOfArguments == 1) {
results = new_msgSend1(sender, selector, getArgument([argumentsList objectAtIndex:0]), getArgument([argumentsList objectAtIndex:1]));
} else if(numberOfArguments == 2){
results = new_msgSend2(sender, selector, getArgument([argumentsList objectAtIndex:0]), getArgument([argumentsList objectAtIndex:1]));
}
} else if([argumentsList count] == 3) {
@bang590
bang590 / SDImageCache.m
Created October 26, 2015 13:22
Change SDWebImage cache directory
@implementation SDImageCache
...
+ (void)changeDefaultCacheDiskToDocument
{
Method origMethod = class_getInstanceMethod(self, @selector(initWithNamespace:));
Method replaceMethod = class_getInstanceMethod(self, @selector(initWithNamespaceInDocument:));
if (origMethod && replaceMethod) {
method_exchangeImplementations(origMethod, replaceMethod);
}
}
@bang590
bang590 / linkmap.js
Last active August 6, 2024 14:59
XCode Linkmap Parser
var readline = require('readline'),
fs = require('fs');
var LinkMap = function(filePath) {
this.files = []
this.filePath = filePath
}
LinkMap.prototype = {
start: function(cb) {
@bang590
bang590 / stepEngine.js
Created October 22, 2012 09:29
stepEngine - simplify everyauth asynchronous resolution
var fs = require('fs'),
http = require('http');
var Promise = function(values) {
this._callbacks = [];
this._errbacks = [];
if (arguments.length > 0) {
this.fulfill.apply(this, values);
}
}