This file contains hidden or 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
| module Thing (isThingy) where | |
| isThingy x = x == "thingy" | |
| -- later... | |
| import Thing | |
| filter isThingy ["stuff", "thingy", "pancakes"] |
This file contains hidden or 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 Thing do | |
| def thingy?(incoming_thing) do | |
| incoming_thing == "thingy" | |
| end | |
| end |
This file contains hidden or 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 StringCalculator.DelimiterTest do | |
| use ExUnit.Case | |
| import StringCalculator.Delimiter | |
| test "when given a string with no custom delimiter, the default delimiter is returned" do | |
| assert delimiter_from("1,2,3") == ~r/(?:,|\n)/ | |
| end | |
| test "when given a string with a custom delimiter, the custom delimiter is extracted and added to the defaults" do | |
| assert delimiter_from("//;\n1,2,3") == ~r/(?:;|,|\n)/ |
This file contains hidden or 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
| def add(input) do | |
| sum map split(delimiter_from(input), numbers_from(input)), &to_integer/1 | |
| end |
This file contains hidden or 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 MyApp.PostsController do | |
| use Phoenix.Controller | |
| require IEx | |
| plug :action | |
| def index(conn, _params) do | |
| IEx.pry | |
| conn |> render "index" | |
| end |
This file contains hidden or 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
| def add(input) do | |
| delimiter_from(input) | |
| |> split(numbers_from(input)) | |
| |> map(&to_integer/1) | |
| |> sum | |
| end |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| git add -A && git commit -m "WIP [ci skip]" |
This file contains hidden or 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
| mspring() { | |
| be spring && \ | |
| while true | |
| do | |
| spring 2>&1 > /dev/null | |
| SPRING_STATUS=`spring status` | |
| clear | |
| echo `date`\\n$SPRING_STATUS | |
| sleep 2 | |
| done |
This file contains hidden or 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
| <% | |
| current_branch_name ||= begin | |
| `/usr/bin/env git branch` =~ /^\*\s+(.*)$/ | |
| current_branch_name = $1.gsub('-', '_') | |
| end | |
| %> | |
| development: | |
| adapter: postgresql | |
| database: myapp_development_<%= current_branch_name %> |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'thor' | |
| require 'pry' | |
| class SmartSpec < Thor | |
| option :all, type: :boolean, aliases: ['-a'] | |
| desc 'fuzzy [PATTERN] *OR* smartspec -- [PATTERN]', 'Find specs matching PATTERN and run one or all of them.' | |
| long_desc <<-DESC | |
| This is the default action of smartspec, so:\x5 |