I hereby claim:
- I am jarsen on github.
- I am jarsen (https://keybase.io/jarsen) on keybase.
- I have a public key ASA-ZqyUHPk5dr-lESy6TrMX4qO5hFqdGOKjBBqrP7qaqQo
To claim this, I am signing this object:
struct Scorekeeper { | |
let runningScore: Int | |
let climbingScore: Int | |
let bikingScore: Int | |
let swimmingScore: Int | |
init(runningScore: Int = 0, climbingScore: Int = 0, bikingScore: Int = 0, swimmingScore: Int = 0) { | |
self.runningScore = runningScore | |
self.climbingScore = climbingScore | |
self.bikingScore = bikingScore |
defmodule MarkovChain do | |
def create_chain(source, ngram_length) do | |
source | |
|> Stream.chunk_every(ngram_length + 1, 1) | |
|> Stream.map(fn chunk -> Enum.split(chunk, ngram_length) end) | |
|> Stream.scan(%{}, fn {ngram, word}, acc -> | |
Map.update(acc, ngram, word, fn val -> val ++ word end) | |
end) | |
end |
#!/usr/local/bin/ruby | |
# crawler.rb | |
# by: Jason Larsen | |
# a generic web crawler that allows the user to do whatever they want by passing blocks | |
# @version 0.7 | |
# 14 Dec 2009 | |
# 0.6 things seem to be working well | |
# 0.7 modified so that URL's being added to the queue truncate fragments, | |
# this should save a lot of work |
NSArray *albums = @[[Album albumWithName:@"Random Access Memories" price:9.99f], | |
[Album albumWithName:@"Clarity" price:6.99f], | |
[Album albumWithName:@"Weekend in America" price:7.99f], | |
[Album albumWithName:@"Weekend in America" price:7.90f], | |
[Album albumWithName:@"Bangarang EP" price:2.99f]]; | |
// Reversing an Array | |
__unused NSArray *reversed = albums.reverseObjectEnumerator.allObjects; | |
// PREDICATES |
import Foundation | |
// | |
// MARK: - JSONError Type | |
// | |
public enum JSONError: ErrorType, CustomStringConvertible { | |
case KeyNotFound(key: String) | |
case NullValue(key: String) | |
case TypeMismatch(expected: Any, actual: Any) |
I hereby claim:
To claim this, I am signing this object:
protocol Debuggable { | |
var debug: Bool { get set } | |
func debugPrint(message: String) | |
} | |
extension Debuggable { | |
func debugPrint(message: String) { | |
if debug { | |
print(message) | |
} |
//: Playground - noun: a place where people can play | |
import UIKit | |
enum JSONError : ErrorType { | |
case NoValueForKey(String) | |
case TypeMismatch | |
} | |
public class JSONObject { |
import Foundation | |
// | |
// MARK: - JSONError Type | |
// | |
public enum JSONError: ErrorType, CustomStringConvertible { | |
case KeyNotFound(key: JSONKeyType) | |
case NullValue(key: JSONKeyType) | |
case TypeMismatch(expected: Any, actual: Any) |
import Cocoa | |
class CSVDoubleSequence: SequenceType { | |
typealias GeneratorType = IndexingGenerator<Array<Double>> | |
let path: String | |
let values: [Double] | |
init(path: String) { | |
self.path = path | |