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
#!/usr/bin/env bash | |
# | |
# A simple wrapper to avoid mixing compile logs and formatting output. | |
# 1. redirect output to /dev/null | |
# 2. avoid reading input from /dev/stdin, which will be used by `mix format` | |
mix compile > /dev/null 2>&1 </dev/null | |
exec mix format $@ |
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
#!/usr/bin/env bash | |
# | |
# ## The Problem | |
# | |
# Can't assign requested address | |
# | |
# It occurs when macOS's TCP stack routing table has become corrupted. | |
# | |
# ## Reproducing | |
# |
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 'reformatter) | |
(defcustom elixir-format--extra-args nil | |
"Extra arguments to pass to mix." | |
:group 'elixir-format | |
:type '(repeat string)) | |
(defun elixir-format--mix-executable () | |
(executable-find "mix")) |
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 MP3 do | |
def get_duration(data) when is_binary(data) do | |
{_, rest} = parse_tag(data) | |
parse_frame(rest, 0, 0, 0) | |
end | |
defp parse_tag(<< | |
"ID3", | |
_major_version::integer, | |
_revision::integer, |
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 PlugOverloadDetector do | |
@moduledoc """ | |
Check the rate of requests, and tag the corresponding connections with | |
`conn.assigns.overload = true` when the rate is too high. | |
> The related package is ex_rated. | |
## Usage | |
### Use in routers |
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
A placeholder aims to pin nothing. |
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
Mix.install([ | |
{:traverse, "~> 1.0"}, | |
{:benchee, "~> 1.0"} | |
]) | |
defmodule Data do | |
def create_sample(count) do | |
sample = %{ | |
user_id: 1, | |
children: [ |
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
#!/usr/bin/env osascript | |
# | |
# Focus on frame by the title of frame. | |
# | |
# Usage: | |
# $ focus-emacs-frame.applescript editor | |
# $ focus-emacs-frame.applescript terminal | |
on run argv | |
if argv is {} then |
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
#!/usr/bin/env osascript | |
# | |
# Usage: | |
# $ ./position-window.applescript <position> | |
# Available postions: | |
# - left | |
# - right | |
# - full | |
# - center | |
# |
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 Hello.Repo do | |
use Ecto.Repo, | |
otp_app: :hello, | |
adapter: Ecto.Adapters.Postgres | |
@doc """ | |
Reverse a preload. | |
## Example |