Skip to content

Instantly share code, notes, and snippets.

@jamztang
jamztang / LICENSE
Created October 10, 2013 04:12
Creating an image of image in specific rect or by proportion
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / 0_reuse_code.js
Created September 25, 2013 04:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jamztang
jamztang / JTDropShadowFixNavigationViewController.h
Last active December 23, 2015 06:09
JTDropShadowFixNavigationViewController - Using custom drop shadows in UINavigationBar (fix for iOS 6.1)
/*
* This file is part of the http://ioscodesnippet.com
* (c) Jamz Tang <jamz@jamztang.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import <UIKit/UIKit.h>
@jamztang
jamztang / JTKeyValueObserver.h
Last active December 19, 2015 19:49
The simplest KVO+Block wrapper. http://ioscodesnippet.com
/*
* This file is part of the http://ioscodesnippet.com
* (c) Jamz Tang <jamz@jamztang.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* Usage:
@jamztang
jamztang / LICENSE
Last active December 13, 2015 20:28
objective-C method swizzling helper
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / LICENSE
Last active November 2, 2019 22:33
UINibDecoderProxy - Use NSProxy to observe what's encoded when views and controllers are created in Interface Builder.
Copyright (c) 2013 Jamz Tang <jamz@jamztang.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@jamztang
jamztang / UIImage+Retina4.h
Created September 14, 2012 16:05 — forked from bstahlhood/UIImage+Retina4.h
Swizzled UIImage imageNamed for iPhone 5
//
// UIImage+Retina4.h
// StunOMatic
//
// Created by Benjamin Stahlhood on 9/12/12.
// Copyright (c) 2012 DS Media Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
@jamztang
jamztang / YourViewController.m
Created August 3, 2012 04:48
Properly handle custom rotation animations in both iOS 4 and iOS 5
@interface YourViewController ()
@property (unsafe_unretained, nonatomic) UIInterfaceOrientation fromInterfaceOrientation;
@end
@implementation YourViewController
@synthesize fromInterfaceOrientation;
#pragma mark Rotations for iOS 5
- (void)viewWillLayoutSubviews {
@jamztang
jamztang / UITableViewDeleteActionResponder.m
Created June 28, 2012 08:08
Fixing the "delete" menu for UITableView shouldShowMenuForRowAtIndexPath
//
// Quick Hack to enable delete menu item
// Original blog post at http://mystcolor.me/post/26114988122/show-delete-menu-item-in-tableview
//
// Updated: 30 June 2012
// I realized there should really be a more elegant way to
// send actions to responder chain, without manually looping
// through the responder chain. Here we implement the
// delete: method in both UITableViewCell and UITableView, so
// that they know the right thing to do in their own delete:
@jamztang
jamztang / UIBlocksView.h
Created June 13, 2012 09:52
UIBlocksView - Adding blocks to UIViews
// ARC based
#import <UIKit/UIKit.h>
typedef void(^UIDrawRectBlock)(CGRect rect);
typedef void(^UILayoutSubviewBlock)(void);
@interface UIBlocksView : UIView
- (void)onDrawRectHandler:(UIDrawRectBlock)block;