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
| from flask import Flask, request, Response | |
| import requests, logging | |
| _FIELD_SEPARATOR = ':' | |
| class SSEClient(object): | |
| """Implementation of a SSE client. | |
| See http://www.w3.org/TR/2009/WD-eventsource-20091029/ for the | |
| specification. | |
| """ |
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
| typedef struct point { | |
| double x,y; | |
| } POINT; | |
| typedef struct ray { | |
| POINT p,v; | |
| } RAY; | |
| typedef struct polygon { | |
| int 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
| web: | |
| image: 'gitlab/gitlab-ce:latest' | |
| restart: always | |
| hostname: 'gitlab.wujianguo.org' | |
| environment: | |
| GITLAB_OMNIBUS_CONFIG: | | |
| external_url 'http://gitlab.wujianguo.org/' | |
| nginx['listen_port'] = 8980 | |
| gitlab_rails['gitlab_shell_ssh_port'] = 8922 | |
| gitlab_rails['time_zone'] = "Asia/Shanghai" |
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 python | |
| # -*- coding: utf-8 -*- | |
| def main(): | |
| pass | |
| if __name__ == '__main__': | |
| main() |
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
| extension UIImageView { | |
| func setImageWithUrlString(str: String?) { | |
| if let url = NSURL(string: str ?? "") { | |
| setImageWithURL(url) | |
| } | |
| } | |
| func setImageWithURL(url: NSURL) { | |
| NSURLSession.sharedSession().dataTaskWithURL(url) { (data, response, error) -> Void in | |
| dispatch_async(dispatch_get_main_queue()) { () -> Void in |
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
| // | |
| // GesturePasswordView.swift | |
| // GesturePassword | |
| // | |
| // Created by wujianguo on 15/10/16. | |
| // Copyright © 2015 wujianguo. All rights reserved. | |
| // | |
| import UIKit |
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 UIKit | |
| protocol CollectionViewCellDeleteDelegate: class { | |
| func collectionViewCellDeleteClick(cell: UICollectionViewCell) | |
| func collectionViewDidSelectCell(cell: UICollectionViewCell) | |
| } | |
| class CanDeleteCollectionViewCell: UICollectionViewCell, UIScrollViewDelegate { | |
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
| func checkVersion(appID: String, complete: (hasNewVersion: Bool, downloadAddr: String?) -> Void) { | |
| NSURLSession.sharedSession().dataTaskWithURL(NSURL(string: "https://itunes.apple.com/lookup?id=\(appID)")!) { (data, response, error) -> Void in | |
| dispatch_async(dispatch_get_main_queue()) { () -> Void in | |
| if error != nil || data == nil { | |
| complete(hasNewVersion: false, downloadAddr: nil) | |
| return | |
| } | |
| do { | |
| let json = try NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) | |
| if let all = json as? NSDictionary { |
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 UIKit | |
| extension UIColor { | |
| /** | |
| * Initializes and returns a color object for the given RGB hex integer. | |
| */ | |
| public convenience init(rgb: Int) { | |
| self.init( |