View publish-heroku.sh
#!/bin/bash | |
echo 'https://github.com/vapor-community/heroku-buildpack' > .buildpacks | |
echo '5.1.3' > .swift-version | |
echo 'web: MySiteName && cd Output && python -m SimpleHTTPServer $PORT' > Procfile |
View Enum+UnknownCaseRepresentable.swift
protocol UnknownCaseRepresentable: RawRepresentable, CaseIterable where RawValue: Equatable { | |
static var unknownCase: Self { get } | |
} | |
extension UnknownCaseRepresentable { | |
init(rawValue: RawValue) { | |
let value = Self.allCases.first(where: { $0.rawValue == rawValue }) | |
self = value ?? Self.unknownCase | |
} | |
} |
View Applicable.swift
import Foundation | |
protocol Applicable {} | |
extension NSObject: Applicable {} | |
extension Applicable { | |
@discardableResult | |
func apply(_ closure: (Self) -> Void) -> Self { | |
closure(self) | |
return self |
View XcodeBumpBuild.sh
if [ $CONFIGURATION == Release ] || [ $CONFIGURATION == TestFlight ]; then | |
echo "Bumping build number..." | |
plist=${PROJECT_DIR}/${INFOPLIST_FILE} | |
# increment the build number (ie 115 to 116) | |
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
if [[ "${buildnum}" == "" ]]; then | |
echo "No build number in $plist" | |
exit 2 | |
fi |
View genymotionwithplay.txt
Download the following ZIPs: | |
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links) | |
Download the correct GApps for your Android version: | |
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip) | |
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip) | |
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip) | |
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip) | |
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip) |
View A_Promise.swift
public struct Promise<T> { | |
typealias Fulfiller = (T) -> (Void) | |
typealias Rejecter = (Void) -> (Void) | |
typealias Resolver = (_ fulfill: @escaping Fulfiller, _ reject: @escaping Rejecter) -> (Void) | |
let resolver: Resolver | |
init(_ resolver: @escaping Resolver){ | |
self.resolver = resolver | |
} | |
func then<U>(_ execute: @escaping ((T) -> U)) -> Promise<U> { | |
return Promise<U>({(fulfill, reject) in |
View swiftybeaver.sh
#!/bin/bash | |
BASE_PATH="${SRCROOT}/swiftybeaver" | |
PLIST_NAME="SwiftyBeaver.plist" | |
PLIST="${BASE_PATH}/${PLIST_NAME}" | |
SCRIPT="${BASE_PATH}/vars.sh" | |
if [ ! -d $BASE_PATH ]; then | |
mkdir -p $BASE_PATH | |
fi |
View git-delete-patch.diff
diff --git a/builtin/branch.c b/builtin/branch.c | |
index 7b45b6b..46bde61 100644 | |
--- a/builtin/branch.c | |
+++ b/builtin/branch.c | |
@@ -215,7 +215,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds, | |
int flags = 0; | |
strbuf_branchname(&bname, argv[i]); | |
- if (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) { | |
+ if (kinds == FILTER_REFS_BRANCHES && !strcasecmp(head, bname.buf)) { |
View movToGif.sh
movToGif() { | |
TARGET="${2:-$1.gif}" | |
ffmpeg -i $1 -r 10 -f gif - | gifsicle --optimize=3 --delay=6 > $TARGET | |
} |
View hello_name.swift
#!/usr/bin/xcrun swift | |
import AppKit | |
struct Hello { | |
static func talk (name: String!) { | |
println("Hello \(name)!") | |
} | |
} |
NewerOlder