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
| var title = "Wikipedia"; | |
| var iconURL = "https://ja.m.wikipedia.org/static/apple-touch/wikipedia.png"; | |
| var linkItemFormat = "http://wikipedia.org/wiki/Special:Search/_Q_" | |
| OHJConvertImgToBase64(iconURL,function(base64Image){ | |
| base64Image = base64Image.replace(/^data.+?base64,/, ''); | |
| window.webkit.messageHandlers.oooDidClickAddLinkItem.postMessage([title,linkItemFormat,base64Image]) | |
| }) |
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
| if [ -z "$TMUX" ]; then | |
| if $(tmux has-session); then | |
| tmux a | |
| else | |
| tmux | |
| fi | |
| fi |
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 Foundation | |
| enum FormatType { | |
| case intType(Int.Type) | |
| case stringType(String.Type) | |
| case string(String) | |
| } | |
| enum MatchedType { | |
| case string(String) |
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 CustomStringConvertible where Self: Enum { | |
| var description: String { | |
| return String(describing: self) | |
| } | |
| } |
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
| protocol EnumStringConvertible {} | |
| extension EnumStringConvertible where Self: Hashable { | |
| var string: String { | |
| return String(describing: self) | |
| } | |
| } | |
| enum Hoge: EnumStringconvertible { | |
| case yo | |
| } |
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
| enum Hoge { | |
| case yoyo(str: String) | |
| case hoi(st: String) | |
| var string: String { | |
| switch self { | |
| case .hoi(st: let str), | |
| .yoyo(str: let str): | |
| return str | |
| } |
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 Kitura | |
| let router = Router() | |
| class RouteMapping1: RouteMapping { | |
| static var format: MappingFormat { | |
| return ("status"/String.self/Int.self) | |
| } | |
| var user_name: String |
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
| class MainController: PageController { | |
| typealias Routing = MainRouting | |
| var context: [String : Any] { | |
| return [ | |
| "user": self.user, | |
| "id": self.id | |
| ] | |
| } |
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
| router.get(":user/status/:id") { | |
| request, response, next in | |
| let user = request.parameters["user"] ?? "" | |
| let id = request.parameters["id"] ?? "" | |
| let context = [ | |
| "user": user, | |
| "id": id | |
| ] | |
| response.status(.OK).render("main", context: context) | |
| } |
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 Foundation | |
| import Fluent | |
| final class User: Entity { | |
| var id: Node? | |
| var name: String | |
| var exists: Bool = false | |
| init(name: String) { |
OlderNewer