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 Slugify do | |
@moduledoc """ | |
The main intent of this module is to be used in slug generation for URLs. | |
Supports russian transliteration. | |
""" | |
@char_mappings %{"а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", | |
"ё" => "e", "ж" => "j", "з" => "z", "и" => "i", "й" => "i", "к" => "k", "л" => "l", "м" => "m", | |
"н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "y", "ф" => "f", | |
"х" => "h", "ц" => "ts", "ч" => "ch", "ш" => "sh", "щ" => "sch", "ъ" => "", "ы" => "y", |
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 MyApp.Schema.ArcResolver do | |
defmacro __using__([uploader: uploader]) do | |
quote do | |
import unquote(__MODULE__), only: [ | |
get_file: 2 | |
] | |
@__arc_upload unquote(uploader) | |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "cmd+t cmd+t", | |
"command": "workbench.action.tasks.runTask", | |
"args": "Run All Tests" | |
}, | |
{ | |
"key": "f5", | |
"command": "workbench.action.tasks.runTask", |
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
# This demonstrates that, when using async/await, a crash in the task will crash the caller | |
defmodule Tasker do | |
def good(message) do | |
IO.puts message | |
end | |
def bad(message) do | |
IO.puts message | |
raise "I'm BAD!" | |
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
#first install all the things: | |
sudo apt-get install flac ffmpeg mp3splt libav-tools shntool | |
# Okay first lets do an MP3: | |
# input files: | |
# --> cd.ape | |
# --> cp.cue | |
# (there are other options, like bitrate, but this is just the bare bones) | |
avconv -i cd.ape cd.mp3 |
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 | |
# HEADS UP! Make sure to use '*' or a valid hostname for the FDQN prompt | |
echo 01 > ca.srl | |
openssl genrsa -des3 -out ca-key.pem | |
openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem | |
openssl genrsa -des3 -out server-key.pem | |
openssl req -new -key server-key.pem -out server.csr |
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
function declOfNum(number, titles) { | |
cases = [2, 0, 1, 1, 1, 2]; | |
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
} | |
use: | |
declOfNum(count, ['найдена', 'найдено', 'найдены']); |
NewerOlder