This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! 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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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):") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
之前看 MySQL 的入门教程的时候发现不是很容易找到和自己环境完全一样的方法,后来问同事,作比较终于走通了。安装方法不只是一种,用的相关 APP 也不是一种,每种都是可行的,但是这里只描述自己更偏好的那一种 :D。这篇文章假设读者开始对 MySQL 都没有一个概念,所以除了软件的安装和配置,还会简单介绍一点点关于 MySQL 的东西。
首先 $ brew install mysql
安装 mysql,之后可能需要重启一下终端,然后成功的话输入 $ mysql
再按 Tab 会提示一些和 mysql 相关的命令出来,如果有的话就 OK 了,如下:
$ mysql
OlderNewer