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 for editing | |
#setup on the command line | |
gem install rspec | |
rspec --init | |
#add to gemfile: | |
group :test, :development do | |
gem 'rspec-rails' | |
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
# Similar to a squashed rebase | |
# Merges branch A into B, and then resets the branch to A, | |
# producing an unstaged diff of B for your commit | |
# exampe usage: `debase master` | |
# (note the lack of `git` prefix) | |
function debase() { | |
if [[ -z $1 ]]; then | |
echo 'missing branch to debase from' | |
else | |
branch=${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
### Keybase proof | |
I hereby claim: | |
* I am expede on github. | |
* I am expede (https://keybase.io/expede) on keybase. | |
* I have a public key whose fingerprint is F233 CD9A 63AE 700A 7BD2 451A FB83 8D90 B29C 377A | |
To claim this, I am signing this object: |
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
(defvar expede-packages | |
'( | |
cucumber-goto-step | |
ac-haskell-process | |
ac-html | |
ac-helm | |
ac-octave | |
brainfuck-mode | |
coffee-mode | |
helm-robe |
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
{:error, "Something went boom"} | |
{:error, "Something went boom", %{original :data}} | |
{:error, %{original: :data}} | |
# Yes, this exists in the wild | |
{:ok, %{error: %{reason: "something went boom", data: %{original: :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
use Exceptional | |
OtherFile.read("./existing_file.txt") ~> String.length | |
# 19 | |
OtherFile.read("./missing.file") ~> String.length | |
# %OtherFile.NotFoundError{ | |
# message: "File not found at ./missing.file", | |
# path: "./missing.file" | |
# } |
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
search_result = find_book(title: title) | |
case search_result do | |
page = %Page{} -> render(page) | |
%Ecto.MultipleResultsError{} when is_series(title) -> | |
%Book.SeriesAreNotBooksError{ | |
message: "#{title} is a series, not a book.", | |
title: title, | |
series: search_result, | |
plug_status: 422 | |
} |
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
# ===================== | |
# Explicit branch names | |
# ===================== | |
branch OtherFile.read("./existing_file.txt"), | |
value_do: String.length, | |
exception_do: fn %{message: msg} -> msg end.() | |
# => 1000 | |
branch OtherFile.read("./missing.file"), |
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
OtherFile.read("./existing_file.txt") | |
~> fn text -> | |
text | |
|> String.length | |
|> fn x -> x / 2 end.() | |
end.() | |
|> to_tagged_status | |
#=> {:ok, 500} | |
# `ok` alias for tagged_status |
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
use Exceptional | |
# Success case | |
iex> OtherFile.read("./existing_file.txt") >>> String.length | |
1000 | |
# Error case | |
iex> OtherFile.read("./missing.file") >>> String.length | |
**(OtherFile.NotFoundError) File not found at ./missing.file |
OlderNewer