Skip to content

Instantly share code, notes, and snippets.

@nomothetis
nomothetis / keybase.md
Created November 19, 2016 22:42
Keybase proof

Keybase proof

I hereby claim:

  • I am nomothetis on github.
  • I am nomothetis (https://keybase.io/nomothetis) on keybase.
  • I have a public key ASCfU6hrq9LQ8TGIIPF0CN1KFrMV2LU6vTxCsszSKvMFwQo

To claim this, I am signing this object:

publc func createLoginproducer(username:String,
password:String) -> SignalProducer<UserState, LoginError> {
// Define processor here.
return createInternalLoginProducer(username:username, password:password, loginStateProcessor:determineLoginStateTest, userStateProcessor:determineUserStateTest)
}
public func createInternalLoginProducer(username : String,
func loginProducer(username:String, password:String) -> SignalProducer<UserState, LoginError> {
return SignalProducer { sink, disposable in
Alamofire.DO_ALAMOFIRE_THINGS { data, response, error in
// do error checking and nil checking and send errors.
// if all is good, send next and complete.
}
} |> tryMap(validateServerError) |> tryMap(validateLogin) |> tryMap(parseLogin)
}
import Foundation
struct ConversationViewSnapshot : Diffable {
func diffWith(diffable: ConversationViewSnapshot) -> ConversationViewDiff {
return ConversationViewDiff.None
}
func applyDiff(diff: ConversationViewDiff) -> ConversationViewSnapshot {
let key = "A-Recursive-Key"
public class Test {
let updateQueue:dispatch_queue_t
init() {
self.updateQueue = dispatch_queue_create("myQueue", DISPATCH_QUEUE_CONCURRENT)
withUnsafePointer(&self.updateQueue) { unsafePointer in
dispatch_queue_set_specific(self.updateQueue, key, unsafePointer, nil)
@nomothetis
nomothetis / gist:1243140
Created September 26, 2011 19:25
Search-and-replace with Regexes in Objective-C.
NSError *err = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"%%.*?%%" options:0 error:&err];
if (!regex) {
[NSException raise:@"badRegularExpression"
format:@"The regular expression was incorrectly constructed. Error was: %@", err];
}
[regex replaceMatchesInString:aMutableString options:0 range:NSMakeRange(0, newURL.length) withTemplate:@""];
@nomothetis
nomothetis / gist:1040861
Created June 22, 2011 19:10
Fish script for committing to SVN via git-svn
# This script requires fish-nuggets, available at:
# http://github.com/nirvdrum/fish-nuggets
function svnc --description "Commit from git master to SVN."
if not is-git
echo "svnc can only be run from a git repository."
return
end
set -l branch (env git symbolic-ref -q HEAD)
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys001
sharedlibrary apply-load-rules all
[Switching to process 21536 thread 0x0]
Pending breakpoint 1 - "auto_refcount_underflow_error" resolved