This file contains 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
total 65808 | |
drwxr-xr-x 150 teo staff 5100 Feb 12 13:29 . | |
drwxr-xr-x 514 teo staff 17476 Feb 12 13:29 .. | |
-rw------- 1 teo staff 262158 Jun 14 2016 CIQAG2GJV22PEMFGP3333POWTK7JC7GWQFZCSC35SOYR3TWUJJY464A.data | |
-rw------- 1 teo staff 87 Apr 27 2016 CIQAG2JGKTPVE2L6ZQHRXBDQ3QEUBTD2CDUVYYYGLN5MVM2KOEX7DKQ.data | |
-rw------- 1 teo staff 262158 Jun 14 2016 CIQAG2OWJJ56CFHQNRJOOLDMND3QBZQFXSZBUGPCHXERPE2YSQL6YWY.data | |
-rw------- 1 teo staff 262158 Jun 14 2016 CIQAG2Q3BKI27HSE7FSBJID3GMPZG7E6BHDM3TM65V4XKXTQQXDSJKY.data | |
-rw------- 1 teo staff 262158 Jun 14 2016 CIQAG2R2GPLKTCBFZYEXU2O7ND4E4JABBSEHZLOFK74RNWWXXW4GZUY.data | |
-rw------- 1 teo staff 262158 Oct 26 2015 CIQAG2S227HDNN55AWTMXQJAOUMRTMW2Y5K3IARNP5ZQMZ6FOOECQYY.data | |
-rw------- 1 teo staff 262158 Jun 14 2016 CIQAG2WSPPG7EEFGEKPGUIAFU6X2JWAUP2U6YUZMX3GNQ57U3RF73KA.data |
This file contains 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
teo@muthr-2 ~/D/go-ipfs> ipfs daemon | |
Initializing daemon... | |
Adjusting current ulimit to 1024... | |
Successfully raised file descriptor limit to 1024. | |
Found outdated fs-repo, migrations need to be run. | |
Run migrations now? [y/N] y | |
=> Looking for suitable fs-repo-migrations binary. | |
=> None found, downloading. | |
=> Running: /var/folders/qx/gcnhmzf529gdkndv2wbz57n00000gn/T/go-ipfs-migrate108616551/fs-repo-migrations -to 5 -y | |
Found fs-repo version 4 at /Users/teo/.ipfs |
This file contains 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
//: Gist by Mike Ash to show how to achieve what Swift has chosen not to. | |
//: So Swift allows us to assign to a constant from a function that returns an optional and | |
//: check that it did indeed return a value by using either | |
//: if let x = funcReturningOptional() { ... } | |
//: or | |
//: guard let x = funcReturningOptional() else { ... } | |
//: But Swift does not provide the ability to do the same for variables, so instead of doing | |
//: if x = funcReturningOptional() { ... } |
This file contains 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
set -g prefix C-a # Set ctrl-a to be the new prefix | |
unbind C-b # Unbind the default prefix | |
set -sg escape-time 1 # Remove command delay | |
# r to reload config | |
bind r source-file ~/.tmux.conf \; display "Configuration reloaded." | |
bind C-a send-prefix # Send prefix through on second use. | |
bind | split-window -h # Vertical split on | | |
bind - split-window -v # Horiz split on - | |
# Bind pane selection keys to vim movement keys. |
This file contains 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
/// This playground shows how to send and receive packets with low-level Posix UPD protocol API. | |
import Foundation /// Used for NSUTF8StringEncoding | |
import XCPlayground | |
/// Ensure the playground doesn't stop executing at the end of the main thread. | |
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true | |
/** Workaround for Swift not having access to the htons, htonl, and other C macros. | |
This is equivalent to casting the value to the desired bitsize and then |
This file contains 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
/// Utilities for (eventually) dealing with | |
/// To be able to map a dictionary we extend it (from thoughtbot/Argo project) | |
// pure merge for Dictionaries | |
func + <T, U>(var lhs: [T: U], rhs: [T: U]) -> [T: U] { | |
for (key, val) in rhs { | |
lhs[key] = val /// Potential loss: Same key will lose existing lhs value. | |
} | |
This file contains 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 Cocoa | |
protocol ThingId { } | |
protocol Thing { | |
typealias IdType | |
func getId() -> IdType | |
} | |
struct MyThingId: ThingId { } |
This file contains 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 Cocoa | |
protocol ThingId { } | |
protocol Thing { | |
func getId<A: ThingId>() -> A | |
} | |
struct MyThingId: ThingId { } |
This file contains 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
let sema = dispatch_semaphore_create(0) | |
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{ | |
// Do async stuff | |
// When finished, signal to continue below. | |
dispatch_semaphore_signal(sema) | |
} | |
// Wait for the load to complete. | |
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER) |
This file contains 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
let methodStart = NSDate() | |
/* ... Do whatever you need to do ... */ | |
let methodFinish = NSDate() | |
let executionTime = methodFinish.timeIntervalSinceDate(methodStart) | |
println("executionTime = \(executionTime)") |