- 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
| #import "ViewController.h" | |
| @interface ViewController () | |
| @property (weak, nonatomic) IBOutlet UIView *yellowView; | |
| @property (weak, nonatomic) IBOutlet UIImageView *imageView; | |
| @end | |
| @implementation ViewController |
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
| The runtime does some initialization via constructor functions that get called before actual program execution. They go by __attribute__((constructor)) in both gcc and clang. | |
| In the case of Objective-C some of them are embedded in the binary by the compiler. You would have to include them in your headers for similar effect. | |
| These functions use data automatically embedded by the compiler. They do things such as building hash tables for the class lookup function which are then used for the actual message passing. | |
| Instances on the other hand are allocated dynamically. | |
| I am doing something similar, so I don't really know a lot better than that, but this is as deep as I have dug. |
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
| Dynamic includes with Angular.js | |
| In a previous post I show how to use includes to partition views. | |
| In that example, I was using static includes that provide limited flexibility. | |
| What if you want to display different information on the same area of the template based on some condition? | |
| You could use a conditional statement inside the include and render different code accordingly, but doing that will most likely result in bloated and difficult to maintain views. |
NewerOlder