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
I just finally had my mind snap into place with understanding of the Y Combinator. Most explanations I read, even the ones using JS, didn't make much sense and were overly long so here follows my own, much simpler explanation. I will be using JS. | |
We have fibonacci to start with, very simple recursive function. | |
It's fixed points are 0 and 1, fib(0) = 0, and fib(1) = 1 | |
That's all a fix point means, when the f(x) == x | |
They are important because they are the only values at which recursion can cease. | |
Our Fibonacci Function | |
====================== |
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
I just finally had my mind snap into place with understanding of the Y Combinator. | |
Most explanations I read, even the ones using JS, didn't make much sense and were | |
overly long so here follows my own, much simpler explanation. I will be using JS. | |
We have fibonacci to start with, very simple recursive function. | |
It's fixed points are 0 and 1, fib(0) = 0, and fib(1) = 1 | |
That's all a fix point means, when the f(x) == x | |
They are important because they are the only values at which recursion can cease. |
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
AsyncBlockOperation is very similar to NSBlockOperation with one caveat; the block you pass to it receives one argument, a reference to the AsyncBlockOperation for the block. When your block is done with its task, it must call [op complete] | |
Example usage: | |
NSOperation* asyncOp = [AsyncBlockOperation blockOperationWithBlock:^(AsyncBlockOperation* op) { | |
NSLog(@"starting op"); | |
double delayInSeconds = 2.0; | |
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); | |
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ |
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
NSLog(@"%@", OR(nil,@"", @{@"foo": @"bar"}, @[])); | |
// outputs {foo = bar;} | |
NSLog(@"%@", OR(nil,@"", @{}, @[])); | |
// outputs [] | |
NSLog(@"%@", OR(nil,@"", @[], @"", @{})); | |
// outputs {} | |
NSLog(@"%@", OR(nil,@"", @[], @"", nil)); |
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
#ifndef XIBXOR_OR | |
// | |
// XXOr.h | |
// | |
// Created by XibXor on 5/5/13. | |
// | |
// Non-coalescing OR macro for variable arguments and variable types including objects/primitives. | |
// Similar to || behavior in ECMAScript | |
// | |
// Usage: OR(a,b,...) |
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
// | |
// XXOr.h | |
// | |
// Created by XibXor on 5/5/13. | |
// | |
// Non-coalescing OR macro for variable arguments and variable types including objects/primitives. | |
// Similar to || behavior in ECMAScript | |
// | |
// Usage: OR(a,b,...) | |
// |
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
void strrev(char *strStart, const int len){ | |
char* strEnd = strStart + len; | |
while (strStart <= (strEnd -= 8)){ | |
__uint64_t buf = *(__uint64_t*)strStart; | |
*(__uint64_t*)strStart = *(__uint64_t*)strEnd; | |
__asm__ ("bswap %0" : "=r" (*(__uint64_t*)strStart) : "0" (*(__uint64_t*)strStart)); |
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
comment *========================================== | |
jagHook | |
Note that: | |
macros are like win32 api; they may modify all registers but ebx, edi, esi | |
your .text section needs to be writable if using the non-procedural hooking | |
if using radasm, add /SECTION:.text|RWE the LINK box under Project -> Project Options] | |
otherwise, just add /SECTION:.text,RWE to linking arguments | |
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
comment *========================================== | |
jagHook by jAgx | |
Note that: | |
macros are like win32 api; they may modify all registers but ebx, edi, esi | |
your .text section needs to be writable if using the non-procedural hooking | |
if using radasm, add /SECTION:.text|RWE the LINK box under Project -> Project Options] | |
otherwise, just add /SECTION:.text,RWE to linking arguments | |
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
comment *========================================== | |
jagHook | |
Note that: | |
macros are like win32 api; they may modify all registers but ebx, edi, esi | |
your .text section needs to be writable if using the non-procedural hooking | |
if using radasm, add /SECTION:.text|RWE the LINK box under Project -> Project Options] | |
otherwise, just add /SECTION:.text,RWE to linking arguments | |
OlderNewer