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
| infix operator =< : AlsoPrecedence | |
| precedencegroup AlsoPrecedence { | |
| higherThan: AssignmentPrecedence | |
| associativity: left | |
| } | |
| public func =<<T>(lhs: T, rhs: (T) throws -> Void) rethrows -> T { | |
| try rhs(lhs) | |
| return lhs |
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 | |
| public final class ScopeBenchmark { | |
| private let startTime = Date() | |
| private let UUID = Foundation.UUID().uuidString.prefix(6) | |
| private var identifier = "" |
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
| [alias] | |
| co = checkout | |
| st = status | |
| ci = commit -a | |
| d = diff | |
| dc = diff --cached | |
| br = branch | |
| s = status --short --branch | |
| rv = remote --verbose | |
| graph = log --graph --date=short --decorate=short --pretty=format:'%C(red)%h %C(reset)-%C(yellow)%d %Creset%s %Cgreen(%cr) %C(bold blue)<%an>%Creset' |
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 std::io; | |
| fn main() { | |
| println!("{}", read_line()) | |
| } | |
| fn read_line() -> String { | |
| let mut line = String::new(); | |
| io::stdin().read_line(&mut line) | |
| .expect("Failed to read line"); |
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
| function processArchive(a,b,c){for(flag=!0;a<$all_li.length;){if($li=$($all_li[a]),$a=$li.find("a"),category_name=$a.text(),breadcrumb=category_name.split("#"),level=breadcrumb.length,1==level&&a>0&&$li.attr("class","on-border"),level<b)return b>2&&$($all_li[a-1]).css("padding-bottom","0px"),a-1;level==b?($a.text(breadcrumb[level-1]),null!=c?$li.appendTo(c):($opend_span=$('<span class="hatena-breadcrumb-plus-toggle-button" id="opend-'+a+'" style="color: #454545">▼</span>'),$closed_span=$('<span class="hatena-breadcrumb-plus-toggle-button" id="closed-'+a+'" style="color: #454545">▶</span>'),$closed_span.css("visibility","hidden"),$opend_span.css("display","none"),$li.prepend($closed_span),$li.prepend($opend_span))):(id=a-1,ulid="hatena-breadcrumb-plus-toggle-"+id,$new_ul=$('<ul id="'+ulid+'" type="square"></ul>'),level>2?$new_ul.attr("class","hatena-breadcrumb-plus-child2"):($new_ul.attr("class","hatena-breadcrumb-plus-child1"),$new_ul.css("display","none")),$($all_li[id]).append($new_ul),$("#closed-"+id).css( |
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 readLines() -> [String] { | |
| var results = [String]() | |
| while(true) { | |
| guard let readLine = readLine() else { | |
| break | |
| } | |
| results.append(readLine) | |
| } | |
| return results | |
| } |
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
| /// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the | |
| /// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json; charset=utf-8`. | |
| public struct JSONWithUTF8CharsetEncoding: ParameterEncoding { | |
| // MARK: Properties | |
| /// Returns a `JSONEncoding` instance with default writing options. | |
| public static var `default`: JSONEncoding { return JSONEncoding() } | |
| /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options. |
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 CoreLocation | |
| import CoreMotion | |
| struct Geofence { | |
| typealias Degreese = Double | |
| typealias Radius = Double | |
| var identifier: String | |
| var radius: Radius |
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
| struct ExampleSender: GoogleAnalyticsSendable { | |
| static var googleAnalyticsTrackingId: String { | |
| "{tracking id}" | |
| } | |
| } | |
| // Usage | |
| ExampleSender.sendEventTracking(category: "example", action: "action") |