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 Day2 do | |
@input File.read!("day2-input.txt") | |
defmodule PosTracker do | |
@callback new() :: Map.t | |
@callback new(integer(), integer()) :: Map.t | |
@callback new(integer(), integer(), integer()) :: Map.t | |
@callback forward(Map.t, integer()) :: Map.t | |
@callback up(Map.t, integer()) :: Map.t | |
@callback down(Map.t, integer()) :: Map.t |
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 SwiftUI | |
enum UnitTypes: CaseIterable, Hashable, Identifiable { | |
case temperature | |
case length | |
case time | |
case volume | |
var name: String { "\(self)".capitalized } | |
var id: UnitTypes { self } |
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
class ViewController: UINavigationController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// This seems like a really bad idea... | |
self.children.first?.navigationItem.titleView = navItemReplacementVIew() | |
} | |
func navItemReplacementVIew() -> UIView { |
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
test "converts Sid param key to sid" do | |
conn = build_conn(:get, "/hello?Sid=123", "Test=abc") | |
%{conn | query_params: Plug.Conn.fetch_query_params(conn)} | |
conn = FinessTwilioParamsPlug.call(conn, @opts) | |
assert conn.params == %{"sid" => "123", "test" => "abc"} | |
end |
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
Test | |
line 2, edit 3 |
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
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^bowler/profile/stats/(.*)/(.*)$ /info/bowler.php?id=$2 [R] |
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
require 'TodoList' | |
class App | |
def self.file_choser | |
puts "Enter a filename to use:" | |
gets.chomp | |
end | |
def self.main | |
file = file_choser |
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
class TodoList | |
attr_accessor :file | |
def load(file = 'todo.txt') | |
@file = file | |
@list = [] | |
# Check that file exists | |
if using_valid_file? | |
# read the file, create a list, create items, add them |
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
Name of some item to do | |
Another items to do | |
IMPORTANT item | |
etc |
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
class TodoItem | |
# provide reader and setter for name and state | |
attr_accessor :name, :state | |
def initialize(name) | |
# store name | |
self.name = name | |
# set state to undone | |
self.state = false | |
end |
NewerOlder