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 / python-smtp-send-qq-mail.py
Last active February 16, 2023 14:59
Python & Email,附上用 Python 发送 QQ 邮箱邮件的代码
import smtplib
from getpass import getpass
def prompt(prompt):
return input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
subject = prompt("Subject: ")
print("Enter message, end with ^D (Unix) or ^Z (Windows):")
@binderclip
binderclip / flask-mail-qq.py
Created August 4, 2015 07:48
用 Flask-Mail 通过 QQ 邮箱发送邮件
from flask import Flask
from flask_mail import Mail, Message
app = Flask(__name__)
app.config.update(
#EMAIL SETTINGS
MAIL_SERVER='smtp.qq.com',
MAIL_PORT=465,
MAIL_USE_SSL=True,

试着去使用 rync

@binderclip
binderclip / try-to-use-demo.md
Created August 22, 2015 15:20
所有的 try-to-use-xxx 的一个思路

背景

常用操作备份

快速上手

更多了解

原理了解

@binderclip
binderclip / mysql-installation-ready-to-hand-on-mac.md
Last active September 19, 2020 08:52
MySQL Installation on Mac

MySQL 安装和上手使用 on Mac

安装

之前看 MySQL 的入门教程的时候发现不是很容易找到和自己环境完全一样的方法,后来问同事,作比较终于走通了。安装方法不只是一种,用的相关 APP 也不是一种,每种都是可行的,但是这里只描述自己更偏好的那一种 :D。这篇文章假设读者开始对 MySQL 都没有一个概念,所以除了软件的安装和配置,还会简单介绍一点点关于 MySQL 的东西。

首先 $ brew install mysql 安装 mysql,之后可能需要重启一下终端,然后成功的话输入 $ mysql 再按 Tab 会提示一些和 mysql 相关的命令出来,如果有的话就 OK 了,如下:

$ mysql