Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am esttorhe on github.
  • I am esttorhe (https://keybase.io/esttorhe) on keybase.
  • I have a public key whose fingerprint is 25F8 FC83 C0A9 2AF7 AA4C BE4A 0838 31FC D4F8 F734

To claim this, I am signing this object:

@esttorhe
esttorhe / where.hs
Created December 30, 2014 05:01
`where` expressions in `Haskell` fails if 2nd one has more than one `tab`
-- This compiles
bmiTell :: Double -> Double -> String
bmiTell weight height
| bmi <= skinny = "You are underweight. Eat more! "
| bmi <= normal = "Looking good!! "
| bmi <= fat = "You are a little fat. Start eating better."
| otherwise = "You are obese. Go see a doctor!."
where bmi = weight / height ^ 2
skinny = 18.5
normal = 25.0
set -o pipefail && xcodebuild -workspace 'Kiosk.xcworkspace' -scheme 'Kiosk' -configuration Debug test -sdk iphonesimulator -destination 'name=iPad Air,OS=8.1' | xcpretty -c --test

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found <-- this doesn't create the lost-found folder

$ git fsck --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
private func processResponse(response: NSURLResponse!, connection: NSURLConnection, data: NSData!, error: NSError!) {
let result =
// Check if there was an error reported back
testError(error, forRequest: connection.originalRequest) >>- { _ in
Result(connection.currentRequest.URL, failWith: NSError(domain: RecordingProtocol.errorDomain, code: -670,
userInfo: [NSLocalizedDescriptionKey: "Unable to extract the request's last path component for file name generation."]))
.analysis(ifSuccess: { url -> Result<NSURL, NSError> in // Extract the request's url
let docsResult = try { // Get the `Documents` folder path
return NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false, error: $0)
}
//
// Warnings.xcconfig
//
// The list of warnings we (don’t) use, and the reasons why.
//
// :MARK: Warnings in use:
// :MARK: -everything
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us.
//
// :MARK: - Warnings not to be promoted:
INSERT INTO 'snippets' ('title', 'body') VALUES
(':+1:', '👍'),
(':-1:', '👎'),
(':100:', '💯'),
(':1234:', '🔢'),
(':8ball:', '🎱'),
(':a:', '🅰'),
(':ab:', '🆎'),
(':abc:', '🔤'),
(':abcd:', '🔡'),
protocol MyProtocol {
func setup()
}
extension MyProtocol where Self: UIViewController {
func setup() {
// Do something here
}
}
049f2fee2903286b7662c0df17bd11c778ff01b51c0feeca95dbed06a2a5c2b99263f294eb5b4d0a92d9dd783bbfd45b36bfb99ce13a8407f9acfa531fa835a13b
@esttorhe
esttorhe / IDEFindNavigatorScopes.plist
Created June 7, 2019 15:08
Xcode Custom Search Scopes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>name</key>
<string>Source Code</string>
<key>predicate</key>
<dict>
<key>predicates</key>