Skip to content

Instantly share code, notes, and snippets.


Alfred Reinold Baudisch alfredbaudisch

View GitHub Profile
alfredbaudisch / pipe_struct.ex
Last active Mar 15, 2021
Elixir: returning the value of a map or struct field using an anonymous fun with a pipe (syntax sugar)
View pipe_struct.ex
defmodule Company do
schema "companies" do
field(:name, :string)
field(:email, :string)
from(c in Company, where: == "foo")
|> (& &
alfredbaudisch / kernel.ex
Created Mar 15, 2021
Elixir: using global operators in pipes
View kernel.ex
# To concat to lists, you normally do:
list = [1]
list ++ [2]
# result: [1, 2]
# How do you do that in pipelines?
# Global operators are under the Kernel module, so you can use them with the pipe operator.
list |> Kernel.++([2])
alfredbaudisch /
Created Dec 23, 2016 — forked from mattweldon/
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new droplet
  • London
  • Ubuntu
  • No apps
  • Add SSH keys
alfredbaudisch / v2.lua
Last active May 23, 2016
Lua operator overloading
View v2.lua
-- Helpers
function v2_add()
-- foo..
-- Vector
local vector = {}
local vector_meta = {}
function vector:new(x, y)
alfredbaudisch / erlang-osx-32bits.txt
Last active Jan 7, 2016
Install Erlang for Elixir on OS X with working Observer to fix the not found error
View erlang-osx-32bits.txt
- Download Erlang source from
- tar zxvf otp_src_18.2.1.tar.gz
- Configure for 32 bits ( won't be generated for 64-bits):
- CFLAGS=-O0 ./configure --disable-hipe --enable-smp-support --enable-threads --enable-kernel-poll
- ./otp_build autoconf
- ./configure && make && sudo make install
- which erl
- Install Elixir
- iex
- :observer.start should finally work
alfredbaudisch /
Created Sep 23, 2015
Android EditText mask for Brazilian telephone numbers. It deals with the default format (xx) xxxx-xxxx as well the newer longer one (xx) xxxxx-xxxx. Máscara de telefones brasileiros para EditText do Android: formata tanto o telefone padrão (xx) xxxx-xxxx, quanto o novo formato (xx) xxxxx-xxxx.
* Adapted to BR phone format from the class
* UsPhoneNumberFormatter by Samik Bandyopadhyay:
public class BrPhoneNumberFormatter implements TextWatcher {
final int MAX_LENGTH = 11;
//This TextWatcher sub-class formats entered numbers as (41) 1234(5)?-6789
alfredbaudisch / Lua.tmLanguage
Last active Dec 12, 2015
Sublime Text 2 Lua language file with support to stored functions. With it Go to Symbol captures all of the following scenarios: local stored; stored = function() end / local class = {}; local stored; class:stored = function() end / class.stored1 = function () end / local function loc(params) end / function glob(params) end
View Lua.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Lua Syntax: version 0.8</string>