- RSB == Right Stick Button
- LSB == Left Stick Button
- RB == Right Bumper
- RT == Right Trigger
- LB == Left Bumper
- LT == Left Trigger
- Y == Y Button (Top)
- A == A Button (Bottom)
public extension Bool {
static func not(_ exp: @autoclosure () -> Bool) -> Bool {
!exp()
}
}
Usage:
Array.prototype.map.call(document.querySelectorAll('nav a'), function (e) { return e.getAttribute('href'); }); |
Being able to insert into a Dictionary<Key, Array<Values>>
without having to explicitly handle the fact that the value array is nil
on the very first insert for a given key.
The code isn't difficult, but it is repetitive boilerplate. And it is also a decent example of extending a generic type in Swift.
# TestFlight has… opinions… about the CFBundleShortVersionString, so this is removed | |
#defaults write ${CODESIGNING_FOLDER_PATH}/Info CFBundleShortVersionString `git describe --dirty=+ --tags --always` | |
# add the version info to the Settings.bundle | |
GitVersion=$(git describe --dirty=+ --tags --always) | |
CFBundleShortVersionString=$(defaults read ${CODESIGNING_FOLDER_PATH}/Info CFBundleShortVersionString) | |
plutil -insert PreferenceSpecifiers.0 -xml "<dict><key>DefaultValue</key><string>${CFBundleShortVersionString} (${GitVersion})</string><key>Key</key><string>Version</string><key>Title</key><string>Version</string><key>Type</key><string>PSTitleValueSpecifier</string></dict>" ${CODESIGNING_FOLDER_PATH}/Settings.bundle/Root.plist |
// env -i swift Application/Acknowledgements.swift > $CODESIGNING_FOLDER_PATH/Settings.bundle/Acknowledgements.plist | |
import Foundation | |
let fileManager = FileManager() | |
let folders = try! fileManager.contentsOfDirectory(atPath: fileManager.currentDirectoryPath).sorted() | |
var specifiers = [[ "Type" : "PSGroupSpecifier", "Title" : "Open Source", "FooterText" : "This application uses the following third party libraries:" ]] | |
folders.forEach { folder in | |
if let path = [ "LICENSE.md", "LICENSE", "COPYING" ].lazy.map({ "\(folder)/\($0)" }).first(where: { fileManager.fileExists(atPath: $0) }) { | |
var license = (try! String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "(c)", with: "©")) |
Github Flavored Markdown (GFMD) is based on Markdown Syntax Guide with some overwriting as described at Github Flavored Markdown
It is easy to write in GFMD. Just write simply like text and use the below simple "tagging" to mark the text and you are good to go!
To specify a paragraph, leave 2 spaces at the end of the line
No matter the business domain or programming language, programmers always end up needing support for ALL of these things in some form,
- Resource Semantics (such as RAII in C++, or finalizers in C#)
- Error Semantics (such as exceptions in most languages, or conditions in Common Lisp)
- Algebraic Types (such as structs and unions in C, or records and DUs in F#)
- Data Abstraction (such as that which is often badly entangled within object systems in OO languages)
FORECAST(x, | |
INDEX(ys,MATCH(x,xs,1)):INDEX(ys,MATCH(x,xs,−1)), | |
INDEX(xs,MATCH(x,xs,1)):INDEX(xs,MATCH(x,xs,−1))) |