Web Site: http://jscamp.asia/ Twitter: http://twitter.com/jscamp_asia
Ping me @cheeaun on Twitter if you found some awesome stuff for #jscamp. This gist will be updated whenever there's new stuff.
| NSUInteger PSPDFHashFromCGRect(CGRect rect) { | |
| return (*(NSUInteger *)&rect.origin.x << 10 ^ *(NSUInteger *)&rect.origin.y) + (*(NSUInteger *)&rect.size.width << 10 ^ *(NSUInteger *)&rect.size.height); | |
| } |
| /** | |
| * Download all WWDC videos and PDFs | |
| * by kirb <http://hbang.ws> / GPLv3 licensed <http://hbang.ws/s/gpl> | |
| * | |
| * Go to <https://developer.apple.com/wwdc/videos> and run this in your JavaScript console | |
| * (option-cmd-i on OS X; F12 on Windows) | |
| * | |
| * Set hd = true if you want HD videos instead of SD (WARNING: will use a large amount of data) | |
| * | |
| * Make sure wget is installed too - it isn't by default for most OSes. You could also change |
| // | |
| // FGOManagedObjectContextStack.h | |
| // | |
| // Created by Indragie Karunaratne on 2012-12-23. | |
| // | |
| #import <Foundation/Foundation.h> | |
| typedef void (^FGOConfigurationBlock)(id); |
Web Site: http://jscamp.asia/ Twitter: http://twitter.com/jscamp_asia
Ping me @cheeaun on Twitter if you found some awesome stuff for #jscamp. This gist will be updated whenever there's new stuff.
| // | |
| // OLD AND BUSTED | |
| // | |
| if ([self.zoomingDelegate respondsToSelector:@selector(zoomingWindow:didZoomOutViewController:)] == YES) | |
| { | |
| // Do something important. | |
| } | |
| // |
Locate the section for your github remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
| typedef void (^LXSResumeBlock)(void); | |
| typedef void (^LXSRunLoopBlock)(LXSResumeBlock resume); | |
| // Call resume() to stop the block from exercising the run loop and break out of the loop/block. | |
| // Failure to call resume() will cause the test to hang indefinitely. | |
| // This is useful to testing asynchronous actions like AFNetworking operations. See https://gist.github.com/2215212 | |
| // With some reference from https://github.com/icanzilb/MTTestSemaphore, I was able to simplify this method. | |
| inline void LXS_exercisesRunLoopInBlock(LXSRunLoopBlock block) { | |
| __block BOOL keepRunning = YES; | |
| block(^{ keepRunning = NO; }); | |
| while (keepRunning && [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.03]]) { |
| # MOTIVATION: As rails apps are growing, people are noticing the drawbacks | |
| # of the ActiveRecord pattern. Several apps I have seen, and several | |
| # developers I have spoken to are looking towards other patterns for object | |
| # persistence. The major drawback with ActiveRecord is that the notion | |
| # of the domain object is conflated with what it means to store/retrieve | |
| # it in any given format (like sql, json, key/value, etc). | |
| # | |
| # This is an attempt to codify the Repository pattern in a way that would | |
| # feel comfortable to beginner and seasoned Ruby developers alike. | |
| # |