Skip to content

Instantly share code, notes, and snippets.

View GuanshanLiu's full-sized avatar

Guanshan Liu GuanshanLiu

View GitHub Profile
@GuanshanLiu
GuanshanLiu / gist:3080963
Created July 10, 2012 04:17 — forked from drunknbass/gist:3074015
Swizzletastic
#include <objc/runtime.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "SwizzleMyNizzleProtocol.h"
BOOL SwizzleMethod(Class _class, SEL origSel, IMP altImp, char *prefix) {
if (_class == NULL || origSel == NULL || altImp == NULL) {
fprintf(stderr, "[Error] Class, SEL or IMP is NULL");
return NO;
@GuanshanLiu
GuanshanLiu / test.m
Created July 10, 2012 07:18 — forked from mikeash/test.m
Cocoa array slicing
#import <Foundation/Foundation.h>
@interface Slice : NSObject
@property NSInteger from;
@property NSInteger to;
@property NSInteger step;
@end
@implementation Slice
@end
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
static const char *gameName = "GameName";
/* Gets the ideal save directory for the target platform.
* @param output A character array, ideally PATH_MAX characters long.
@GuanshanLiu
GuanshanLiu / gist:de4c4c92db031a3b765ccf10186ceb36
Last active August 26, 2016 02:29 — forked from casademora/gist:c4b19d8503767479c0e05a836de4aa4c
Animation behaviors demo from Shanghai Cocoaheads
//
// ViewController.swift
// BehaviorsDemo
//
// Created by Saul Mora on 8/25/16.
// Copyright © 2016 Magical Panda. All rights reserved.
//
import UIKit