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
You can now send me #bitcoin here: https://onename.io/robert_brown | |
Verifying that +robert_brown is my Bitcoin username |
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
defmodule Simulator do | |
defstruct name: "", version: "", directory: "" | |
# Uses the home directory to find the devices directory. | |
case :init.get_argument(:home) do | |
{:ok, [[dir]]} -> | |
@simulator_dir :filename.join [dir, "Library", "Developer", "CoreSimulator", "Devices"] | |
_ -> | |
IO.puts "Unable to find the home directory." |
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
defmodule Life do | |
# Defaults to B3/S23 | |
defstruct cells: [[]], born: [3], stays: [2, 3], width: 10, height: 10, step: 0 | |
def run(file) do | |
file |> read_file |> loop | |
end | |
def loop(life) do |
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
// | |
// RBNetworkActivityIndicatorManager.h | |
// | |
// Copyright (c) 2011 Robert Brown | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
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
// | |
// RBSimpleSingleton.h | |
// | |
// Copyright (c) 2011 Robert Brown | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
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
defmodule StageInspector do | |
alias Experimental.{GenStage} | |
use GenStage | |
def init(type) when type in [:consumer, :producer_consumer] do | |
{type, type} | |
end | |
def handle_events(events, _from, state = :consumer) do | |
Enum.each events, &inspect_event/1 |
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
defmodule ZipList do | |
defstruct previous: [], current: nil, remaining: [] | |
def from_list(list, index \\ 0) | |
def from_list([], _), do: {:error, :empty_list} | |
def from_list(list, index) when length(list) < index, do: {:error, :index_out_of_bounds} | |
def from_list(list, index) when is_list(list) do | |
previous = list |> Enum.take(index) |> Enum.reverse | |
[current | remaining] = Enum.drop list, index | |
ziplist = %__MODULE__{previous: previous, current: current, remaining: remaining} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
// ---------------------------- | |
// Create the "object". | |
// Basically it's a dispatch table. | |
typealias Person = (String) -> Any | |
var PersonInit: ((String, String) -> Person)! |
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
// | |
// Actor.Swift | |
// | |
// Copyright (c) 2017 Robert Brown | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is |
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 Foundation | |
import Actor | |
import MessageRouter | |
public final class Core<State, Event, Command> { | |
public typealias CommandProcessor = (Core<State, Event, Command>, Command) -> Void | |
public typealias EventHandler = (State, Event) -> CoreUpdate<State, Command> | |
public let stateChanged = MessageRouter<State>() |
OlderNewer