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 App.Service do | |
| @spec parse() :: {:ok, String.t()}, | {:error, String.t()} | |
| def parse do | |
| url = "https://example.com/foo.txt" | |
| case HTTPoison.get(url) do | |
| {:ok, %HTTPoison.response{status_code: 200, body: body}} -> | |
| body # Note: Not {:ok, body} | |
| _ -> |
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
| function lb() { | |
| local_bundle_ver=$(grep -A1 "BUNDLED WITH" Gemfile.lock | grep -v BUNDLED | tr -d '[:space:]') | |
| if [ -n "$local_bundle_ver" ]; then | |
| echo "Using bundler ${local_bundle_ver}" | |
| bundle _${local_bundle_ver}_ $* | |
| else | |
| echo "Could not determine correct version of bundler to use. Sorry!" | |
| fi | |
| } |
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
| function local_bundle() { | |
| local_bundle_ver=$(grep -A1 "BUNDLED WITH" Gemfile.lock | grep -v BUNDLED | tr -d '[:space:]') | |
| if [ -n "$local_bundle_ver" ]; then | |
| echo "Using bundler ${local_bundle_ver}" | |
| bundle _${local_bundle_ver}_ $* | |
| else | |
| echo "Could not determine correct version of bundler to use. Sorry!" | |
| fi | |
| } |
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
| ___ | |
| /\__ _\/\ \ __ /\__ _\ /\ _ \ | |
| \/_/\ \/\ \ \___ /\_\ ____ \/_/\ \/ ____ \ \ \L\ \ | |
| \ \ \ \ \ _ `\/\ \ /',__\ \ \ \ /',__\ \ \ __ \ | |
| \ \ \ \ \ \ \ \ \ \/\__, `\ \_\ \__/\__, `\ \ \ \/\ \ | |
| \ \_\ \ \_\ \_\ \_\/\____/ /\_____\/\____/ \ \_\ \_\ | |
| \/_/ \/_/\/_/\/_/\/___/ \/_____/\/___/ \/_/\/_/ | |
| ____ __ | |
| /'\_/`\ __ /\ _`\ /\ \ |
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
| iex(30)> flush | |
| {:circuits_uart, "ttyACM0", "BY 0,1"} | |
| {:circuits_uart, "ttyACM0", "BY 0,0"} | |
| :ok | |
| iex(31)> flush | |
| {:circuits_uart, "ttyACM0", "FQ 0,0146985000"} | |
| {:circuits_uart, "ttyACM0", "FQ 0,0147030000"} | |
| {:circuits_uart, "ttyACM0", "FQ 0,0147060000"} | |
| {:circuits_uart, "ttyACM0", "FQ 0,0147120000"} | |
| {:circuits_uart, "ttyACM0", "FQ 0,0147165000"} |
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
| iex(8)> flush | |
| {:circuits_uart, "ttyACM0", "$GPRMC,,V,,,,,,,,,,N*53\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPGGA,,,,,,0,,,,,,,,*66\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPRMC,,V,,,,,,,,,,N*53\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPGGA,,,,,,0,,,,,,,,*66\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPRMC,,V,,,,,,,,,,N*53\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPGGA,,,,,,0,,,,,,,,*66\r\n"} | |
| {:circuits_uart, "ttyACM0", "$$CRC6CCE,W8SXT>API510,DSTAR*:"} | |
| {:circuits_uart, "ttyACM0", "$GPRMC,,V,,,,,,,,,,N*53\r\n"} | |
| {:circuits_uart, "ttyACM0", "$GPGGA,,,,,,0,,,,,,,,*66\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
| iex(3)> Nerves.UART.enumerate() | |
| %{ | |
| "ttyACM0" => %{ | |
| description: "TH-D74", | |
| manufacturer: "JVC KENWOOD", | |
| product_id: 24587, | |
| vendor_id: 8550 | |
| }, | |
| "ttyS0" => %{} | |
| } |
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 | |
| get_latest_sha () { | |
| heroku releases --num 1 --remote $1 2> /dev/null | grep -v === | awk '{print $3}' | |
| } | |
| STAGING_SHA=$(get_latest_sha "staging") | |
| PRODUCTION_SHA=$(get_latest_sha "production") | |
| echo "Staging: $STAGING_SHA, Production: $PRODUCTION_SHA" |
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 | |
| set -e | |
| BASE_DIR="${HOME}/Pictures/uploads" | |
| BUCKET="your-s3-bucket-name" | |
| FILENAME=$(uuidgen).png | |
| FULL_PATH="${BASE_DIR}/${FILENAME}" |
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
| # This works | |
| final_zip_codes = | |
| zip_codes | |
| |> Enum.map(& &1[:id]) | |
| |> Enum.sort() | |
| # This also works |
NewerOlder