Skip to content

Instantly share code, notes, and snippets.

@bang590
bang590 / invokeVariableParameterMethod.m
Last active Mar 2, 2016
JSPatch invokeVariableParameterMethod() expand
View invokeVariableParameterMethod.m
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 Oct 26, 2015
Change SDWebImage cache directory
View SDImageCache.m
@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 Aug 6, 2020
XCode Linkmap Parser
View linkmap.js
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 Oct 22, 2012
stepEngine - simplify everyauth asynchronous resolution
View stepEngine.js
var fs = require('fs'),
http = require('http');
var Promise = function(values) {
this._callbacks = [];
this._errbacks = [];
if (arguments.length > 0) {
this.fulfill.apply(this, values);
}
}
You can’t perform that action at this time.