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
--Apple-Mail=_59C7D647-374A-400F-8319-847E1514446E | |
Content-Transfer-Encoding: quoted-printable | |
Content-Type: text/html; | |
charset=utf-8 | |
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = | |
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = | |
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = | |
class=3D""><h2 class=3D"chapter-name" style=3D"border: 0px; font-size: = | |
2.8em; margin: 21px 0px 0px; outline: 0px; padding: 15px 25px; = |
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 Issues.GitHubIssues do | |
@user_agent [{"User-agent", "Issues [email protected]"}] | |
def fetch(user, project) do | |
issues_url(user, project) | |
|> HTTPoison.get(@user_agent) | |
|> handle_response | |
end | |
def issues_url(user, project) 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
defmodule Issues.CLI do | |
@moduledoc """ | |
Handle the command line parsing and the dispatch to the various functions | |
that end up generating a table of the last _n_ issues in a GitHub project. | |
""" | |
@default_count 4 | |
def run(argv) do | |
argv |
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 Parse do | |
def calculate(expression) do | |
{ left, rest } = Enum.split_while(expression, &(!(&1 in '+-*/'))) | |
[ op | right ] = rest | |
{ result, _ } = Code.eval_quoted { :erlang.list_to_atom([op]), [], | |
[value(left), value(right)] } | |
result | |
end | |
defp value(digits) 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
defmodule Eval do | |
def calculate(str), do: _calculate(str) | |
defp _calculate(str) do | |
{op, i} = find(str) | |
list1 = Enum.slice(str, 0..i-1) | |
list2 = Enum.slice(str, i+2..length(str)) | |
_calculate(op, list1, list2) | |
end | |
defp _calculate(?+, list1, list2), do: number(list1) + number(list2) |
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 Countdown do | |
def sleep(seconds) do | |
receive do | |
after seconds*1000 -> nil | |
end | |
end | |
def say(text) do | |
spawn fn -> :os.cmd('say #{text}') end | |
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
defmodule Swapper do | |
def swap([]), do: [] | |
def swap([a,b | tail]), do: [b, a | swap(tail)] | |
def swap([_]), do: raise "Can't swap a list with an odd number of elements" | |
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
source 'https://rubygems.org' | |
require 'json' | |
require 'open-uri' | |
versions = JSON.parse(open('https://pages.github.com/versions.json').read) | |
gem 'github-pages', versions['github-pages'] | |
gem 'rake' | |
gem 'rouge' | |
gem 'html-proofer' |
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
# Site settings | |
title: seitz - a blog or something | |
email: [email protected] | |
description: > # this means to ignore newlines until "baseurl:" | |
This site exists as a resource for me to dump all the little thoughts | |
that come to me concerning programming. I am interested in Rust and | |
functional programming languages. | |
baseurl: "" # the subpath of your site, e.g. /blog | |
url: "http://seitz.space" # the base hostname & protocol for your site | |
twitter_username: ds3itz |
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 X { | |
int x[3]; | |
public: | |
X() : x{0, 1, 3} {} | |
}; | |
int main() { | |
X x; | |
} |
NewerOlder