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
#!/bin/bash | |
# Updates either the Elixir or erlang version everywhere in the project | |
set -e | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 old_version new_version. Example: $0 1.15.7 1.16.1" | |
exit 1 | |
fi |
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 Mix.Tasks.ConvertToVerifiedRoutes do | |
@shortdoc "Fix routes" | |
use Mix.Task | |
@regex ~r/(Routes\.)(.*)_(path|url)\(.*?\)/ | |
@web_module MyAppWeb | |
def run(_) do | |
Path.wildcard("lib/**/*.*ex") |
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
let Uploaders = {} | |
Uploaders.S3 = function (entries, onViewError) { | |
entries.forEach(entry => { | |
let xhr = new XMLHttpRequest() | |
onViewError(() => xhr.abort()) | |
xhr.onload = () => (xhr.status === 200 ? entry.done() : entry.error()) | |
xhr.onerror = () => entry.error() | |
xhr.upload.addEventListener("progress", event => { | |
if (event.lengthComputable) { |
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
# tested on macOS 10.12.4 | |
# based on https://elixirforum.com/t/how-to-change-a-phoenix-project-name-smoothly/1217/6 | |
# replace values as necessary | |
current_otp="hello_phoenix" | |
current_name="HelloPhoenix" | |
new_otp="" | |
new_name="" | |
git grep -l $current_otp | xargs sed -i '' -e 's/'$current_otp'/'$new_otp'/g' |
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 XmlNode do | |
require Record | |
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl") | |
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl") | |
def from_string(xml_string, options \\ [quiet: true]) do | |
{doc, []} = | |
xml_string | |
|> :binary.bin_to_list | |
|> :xmerl_scan.string(options) |