Skip to content

Instantly share code, notes, and snippets.


Angelika Tyborska angelikatyborska

View GitHub Profile
angelikatyborska / .zshrc
Last active May 30, 2022
Prevent yourself from using the wrong js package manager
View .zshrc
npm() {
if [ -f yarn.lock ]; then
echo 'use yarn';
command npm $*;
yarn() {
if [ -f package-lock.json ]; then
View pot-loader.js
const { spawnSync } = require('child_process')
const fs = require('fs')
const path = require('path')
const os = require('os')
const glob = require('glob')
// this loader "imports" a .pot file by compiling all of the .po files under the same domain
// into a JSON with translations that can be used by vue-gettext
// E.g.:
angelikatyborska / gettext.ex
Last active Jan 16, 2022
A custom `gettext_with_link` macro for easily putting inline links into gettext strings
View gettext.ex
# Has one external dependency except for Gettext:
defmodule MyApp.Gettext do
@doc """
A helper for translations with links.
Pass in the translation string which must include
`%{link_start}`/`%{link_end}`. For multiple URLs, use
angelikatyborska / gettext_test.exs
Last active Jan 16, 2022
A unit test for Gettext translations that checks if the original and the translation use the same HTML tags. Uses Floki to parse HTML.
View gettext_test.exs
defmodule MyAppWeb.GettextTest do
use ExUnit.Case
import MyAppWeb.Gettext
# A unit test for Gettext translations that checks if the original and the translation
# use the same HTML tags.
# Uses Floki to parse HTML.
describe "translations" do
angelikatyborska / rpg.ex
Created Aug 15, 2021
Protocol consolidation vs mix test --no-compile
View rpg.ex
# test/rpg_test.exs
defmodule RPGTest do
use ExUnit.Case
alias RPG.{Edible, LoafOfBread}
describe "LoafOfBread" do
test "implements the Edible protocol" do
{:consolidated, modules} = Edible.__protocol__(:impls)
angelikatyborska / myphoenixapp.service
Created Mar 10, 2021
Phoenix app serviced service file
View myphoenixapp.service
# /etc/systemd/system/myphoenixapp.service
Description=Runner for My Phoenix App
angelikatyborska /
Last active Nov 29, 2020
Exercism Elixir maintainers Slack channel welcome message


So you want to help out with the Elixir track on Exercism? That's awesome! 💜

There are plenty of tasks that you can help with.

If you have any questions, if you're unsure where to start or you're stuck, do not hesitate to ask for help in our #maintaining-elixir Slack channel.

View gist:6f7d2fe7df779ff87082af115093eda2
git ls-files | egrep '\.erl|\.ex[s]$' | xargs cat | sed '/^$/d' | wc -l
View angelika.zsh-theme
# requires the git-prompt zsh plugin, which in turn requires python2
PROMPT="%{$fg[blue]%}%n%{$reset_color%} in "
PROMPT+='%{$fg[cyan]%}%~%{$reset_color%} $(git_super_status)'
%(?:%{$fg_bold[green]%}$ :%{$fg_bold[red]%}$ )%{$reset_color%}'
angelikatyborska / index.html
Last active Aug 6, 2020
Custom validation messages - 3 inputs
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Form Validation</title>
body { padding: 10px; }