Skip to content

Instantly share code, notes, and snippets.

View binderclip's full-sized avatar
👨‍💻
build

clip binderclip

👨‍💻
build
  • Beijing
View GitHub Profile
@binderclip
binderclip / ios-get-system-version
Created January 29, 2015 06:30
Returns the major version of iOS, from Apple Samplecode: DateCell
/*! Returns the major version of iOS, (i.e. for iOS 6.1.3 it returns 6)
*/
NSUInteger DeviceSystemMajorVersion()
{
static NSUInteger _deviceSystemMajorVersion = -1;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_deviceSystemMajorVersion =
[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."][0] integerValue];
@binderclip
binderclip / 0_reuse_code.js
Last active August 29, 2015 14:17
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
@binderclip
binderclip / sharedInstance
Created March 20, 2015 07:19
OC 中单例的实现
#import "RageIAPHelper.h"
@implementation RageIAPHelper
+ (RageIAPHelper *)sharedInstance {
static dispatch_once_t once;
static RageIAPHelper * sharedInstance;
dispatch_once(&once, ^{
NSSet * productIdentifiers = [NSSet setWithObjects:
@"pw.xkk.inapprangewythest.nightlyrage",
@binderclip
binderclip / ios_oc_timer
Last active August 29, 2015 14:17
OC 定时函数的实现
NSTimer *timer = [NSTimer timerWithTimeInterval:(0.1f) target:self selector:@selector(updateValue:) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:UITrackingRunLoopMode];
@binderclip
binderclip / ios_create_empty_prj
Created March 25, 2015 08:08
iOS 创建空工程,不使用 Storyboard
// First Config: target -> general -> Deployment Info -> Main Interface (Clear!)
// Then can move the Main.storyboard
// Only ViewController
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *viewController = [[ViewController alloc] init];
self.window.rootViewController = viewController;
[self.window makeKeyAndVisible];
// With Navigation Controller
@binderclip
binderclip / atom-and-python.md
Created September 14, 2015 12:50
use atom for python coding

自动补齐

  • 自带的 language-python 已经支持一部分的自动补齐
  • 更高级的可以使用 autocomplete-python

代码检查(使用 Flake)

@binderclip
binderclip / play.md
Last active September 18, 2015 11:05
play use curl
@binderclip
binderclip / simple-ad-stat.html
Created October 12, 2015 04:12
简单的广告统计测试页面
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>广告统计</title>
<script src="jquery.js"></script>
</head>
<body>
<a href="http://localhost:8000/apple" ad-load-url="http://localhost:8000/apple/load" ad-click-url="http://localhost:8000/apple/click">apple</a>
<a href="http://localhost:8000/orange" ad-load-url="http://localhost:8000/orange/load" ad-click-url="http://localhost:8000/orange/click">orange</a>
@binderclip
binderclip / hello_http_proxy.py
Created December 23, 2015 06:59
写一个简单的 HTTP 代理服务器
#!/usr/bin/env python
# coding: utf-8
import socket
import sys
from thread import *
try:
listening_port = int(raw_input("[*] Enter Listening Port Number: "))
except KeyboardInterrupt:
print("\n[*] User Requested An Interrupt")
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
<title>w3cschool Home Page</title>
<link>http://www.w3cschool.cc</link>
<description>Free web building tutorials</description>
<item>
<title>RSS Tutorial</title>
<link>http://www.w3cschool.cc/rss</link>