Skip to content

Instantly share code, notes, and snippets.

@tony0x59
tony0x59 / .gitignore
Created March 27, 2014 05:11
.gitignore file for iOS dev
# from: https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
@tony0x59
tony0x59 / nginx.conf
Created April 23, 2014 09:53
Nginx RTMP Configure
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@tony0x59
tony0x59 / UITableView+CellForPressedButton.m
Created April 28, 2014 07:54
用于替代DirtyHack([[sender superview] superview])
#import "UITableView+CellForPressedButton.h"
@implementation UITableView (CellForPressedButton)
- (NSIndexPath*)indexPathForPressedButton:(UIView*)button
{
CGPoint buttonPosition = [button convertPoint:CGPointZero toView:self];
NSIndexPath *indexPath = [self indexPathForRowAtPoint:buttonPosition];
return indexPath;
}
@tony0x59
tony0x59 / 0_reuse_code.js
Created May 31, 2014 10:54
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
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@tony0x59
tony0x59 / FLVTemplateEx.bt
Last active August 29, 2015 14:03
FLV File format parser for 010 Editor
//-----------------------------------
//--- 010 Editor v5.0.1 Binary Template
//
// File: FLVTemplateEx.bt
// Author: lafei(indep@263.net), Tony(HanningKong@gmail.com)
// Revision: 3.0
// Purpose: Defines a template for
// parsing FLV files.
// Tony Update: base lafie version, add a lot of data deail info:
// 1. Metadata detail info
@tony0x59
tony0x59 / uncrustify.cfg
Created July 3, 2015 10:33
uncrustify.cfg
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
@tony0x59
tony0x59 / GradientView.m
Last active December 17, 2015 18:19
iOS UIView 渐变色绘制
//
// GradientView.m
// GradientDemo
//
// Created by Tony Kong on 13-5-26.
// Copyright (c) 2013年 Tony Kong. All rights reserved.
//
#import "GradientView.h"
@tony0x59
tony0x59 / UIColor+CreateMethod.h
Last active December 19, 2015 01:19
UIColor便捷设置
#define UIColorFromHexRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define UIColorFrom8BitRGB(r, g, b) [UIColor \
colorWithRed:(r)/255.0 \
green:(g)/255.0 \
blue:(b)/255.0 alpha:1.0]
@tony0x59
tony0x59 / moveInAnimateUIView.m
Last active December 21, 2015 22:19
从顶部弹出视图的动画效果,当退出视图时调用[self leaveView]将视图弹出。
#pragma mark - UIAnimation
- (void)willMoveToSuperview:(UIView *)newSuperview
{
[self enterView];
}
#define ANIMATE_DURATION 0.3
- (void)enterView
{