- Array 是 value type,使用 structs 实现
- 数据类型没有隐式转换
- 对于 String,count() 的复杂度是 O(n),每一个 Character 都是 unicode scalars 的序列
- raw values 和 associated values 的区别
- 如果必要,value types 会被自动桥接成 reference types
- 讲一下 unowned 和 weak 的区别
- 改 struct 的属性的方法名前要加 mutating,但如果这个 struct 用 let 声明的,改不了
- nil 和 .None 的区别
- capture list in closure
- 举一个 guard ... where 的例子
This file contains hidden or 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
| ssl_certificate /etc/nginx/ssl/site.bundle.cer; | |
| ssl_certificate_key /etc/nginx/ssl/site.key; | |
| ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
| ssl_prefer_server_ciphers on; | |
| ssl_session_cache shared:SSL:10m; | |
| ssl_dhparam /etc/nginx/ssl/wildcard/dhparam.pem; | |
| # Set the ciphers to use. You may have to fix formatting. | |
| ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK'; | |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| #First released as C++ program by Hiroyuki Tsutsumi as part of the free software suite “Beer” | |
| #I thought porting it to Python could be both a challenge and useful | |
| from sys import argv, exit, getsizeof | |
| from struct import pack_into, unpack_from | |
| def ceil4(n): |
This file contains hidden or 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
| http { | |
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
| proxy_temp_path /var/tmp; | |
| include mime.types; | |
| default_type application/octet-stream; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| gzip on; | |
| gzip_comp_level 6; |
This file contains hidden or 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 hidden or 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
| <!doctype html> | |
| <html ng-app="Demo" ng-controller="AppController"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title> | |
| Creating Asynchronous Alerts, Prompts, And Confirms In AngularJS | |
| </title> | |
| </head> | |
| <body> |
This file contains hidden or 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
| /** | |
| * AngularJS example directive. | |
| * Allows you to modify the page DOM and CSS styles before printing by exexuting the passed expression. | |
| * Will force a $digest phase before the print operation. | |
| * | |
| * Example: <div ng-class="{printed: isPrinted}" on-before-print="printed = true" /> | |
| */ | |
| module.directive('onBeforePrint', ['$window', '$rootScope', '$timeout', function onBeforePrint($window, $rootScope, $timeout) { | |
| var beforePrintDirty = false; | |
| var listeners = []; |
This file contains hidden or 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
| // Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
| // Copyright (c) 2013 Peter Steinberger. All rights reserved. | |
| // Licensed under MIT (http://opensource.org/licenses/MIT) | |
| // | |
| // You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
| #import <objc/runtime.h> | |
| #import <objc/message.h> | |
| // Compile-time selector checks. |
This file contains hidden or 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
| //express3.0 | |
| var express = require('express'); | |
| var app = express(); | |
| app.set('port', 3000); | |
| app.set('views', __dirname + '/views'); | |
| app.set('view engine', 'jade'); | |
| app.use(express.bodyParser()); | |
| app.use(express.methodOverride()); | |
| //session & cookie |
This file contains hidden or 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
| <?xml version="1.0"?> | |
| <root> | |
| <item> | |
| <name>F19 to F19</name> | |
| <appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, F19)</appendix> | |
| <identifier>private.f192f19</identifier> | |
| <autogen> | |
| --KeyOverlaidModifier-- | |
| KeyCode::F19, | |
| KeyCode::COMMAND_L, |
NewerOlder