Skip to content

Instantly share code, notes, and snippets.

View hiddenmemory's full-sized avatar

hiddenGithub hiddenmemory

View GitHub Profile
@hiddenmemory
hiddenmemory / gist:0a9069dd276c7fca263f
Last active August 29, 2015 14:06
API naive example
class API {
private var firstCompletionHandlers: [() -> ()] = []
private var hasCompletedFirst = false
private func completeFirst() {
hasCompletedFirst = true
// API CALL RESPONSE
if firstCompletionHandlers.count > 0 {
for value in firstCompletionHandlers {
#include <stdio.h>
#include "GLK2GetError.h"
#include <GLKit/GLKit.h>
void _gl2CheckAndClearAllErrorsImpl(char *source_function, char *source_file, int source_line)
{
GLenum glErrorLast;
while( (glErrorLast = glGetError()) != GL_NO_ERROR ) // GL spec says you must do this in a WHILE loop
{
/** OpenGL spec defines only 6 legal errors, that HAVE to be re-used by all gl method calls. OH THE PAIN! */
@hiddenmemory
hiddenmemory / UIView+ResourceHelper.h
Created May 16, 2012 18:54
ResourceHelper - applyBorderOffset
#import <UIKit/UIKit.h>
@interface UIView (ResourceHelper)
- (void)rh_applyBorderOffset:(CGRect)offset;
@end
@hiddenmemory
hiddenmemory / CoreData.m
Created February 2, 2012 16:50
SELECT name FROM SomeObject WHERE type = 'static' GROUP BY name [iOS5 Core Data ARC Remix]
- (NSArray*)listOfNames {
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"SomeObject" inManagedObjectContext:self.managedObjectContext]];
[request setResultType:NSDictionaryResultType];
[request setPropertiesToFetch:[NSArray arrayWithObject:@"name"]];
[request setPropertiesToGroupBy:[NSArray arrayWithObject:@"name"]];
[request setPredicate:[NSPredicate predicateWithFormat:@"type = %@", @"static"]];
@hiddenmemory
hiddenmemory / Example.m
Created July 21, 2011 13:58
The implementation for a block based UIAlertView
- (void)deleteFile:(NSString*)file {
[[HMAlertView alertViewWithTitle:@"Delete File"
message:@"Are you sure?"
cancelTitle:NSLocalizedString(@"No", @"")
cancelAction:nil
confirmTitle:NSLocalizedString(@"Yes", @"")
confirmAction:^(void) {
[[NSFileManager defaultManager] removeItemAtPath:file error:nil];
}] show];
}
/* iOS scrollpane jQuery plugin, v1.0
* ==================================
*
* (c) 2011 Dave Gurnell
* http://boxandarrow.com
*
* Distributed under the Creative Commons Attribution 3.0 Unported licence:
* http://creativecommons.org/licenses/by/3.0/
*/