Skip to content

Instantly share code, notes, and snippets.

Grapes Vibes

Herminio Torres herminiotorres

Grapes Vibes
View GitHub Profile
View parser_combinator.ex
defmodule Parser do
def numero() do
<<c::utf8>> <> rest ->
case c do
c when c in ?0..?9 -> {:ok, c - ?0, rest}
_ -> {:error, {:numero, :no_parse, c}, <<c::utf8>> <> rest}
mcrumm / page_live_test.exs
Created Feb 8, 2021
LiveView artifacts
View page_live_test.exs
defmodule MyAppWeb.PageLiveTest do
use MyAppWeb.ConnCase
import Phoenix.LiveViewTest
@tag :tmp_dir
test "disconnected and connected render", %{conn: conn, tmp_dir: tmp_dir} do
{:ok, page_live, disconnected_html} = live(conn, "/")
assert disconnected_html =~ "Welcome to Phoenix!"
View linux-mac-keys.txt
org.gnome.desktop.wm.keybindings switch-group ['<Super>Above_Tab', '<Alt>Above_Tab']
org.gnome.desktop.wm.keybindings begin-resize ['<Alt>F8']
org.gnome.desktop.wm.keybindings switch-to-workspace-7 []
org.gnome.desktop.wm.keybindings begin-move ['<Alt>F7']
org.gnome.desktop.wm.keybindings move-to-side-w []
org.gnome.desktop.wm.keybindings move-to-corner-nw []
org.gnome.desktop.wm.keybindings move-to-workspace-10 []
org.gnome.desktop.wm.keybindings move-to-workspace-6 []
org.gnome.desktop.wm.keybindings move-to-workspace-right ['<Control><Shift><Alt>Right']
org.gnome.desktop.wm.keybindings always-on-top []
# credits:
use strict;
my $action = '';
my $filename = '-';
for my $arg (@ARGV){
contraexemplo /
Last active Mar 2, 2021
Como ativar o módulo de cancelamento de ruído do PulseAudio

Primeiro, verifique se o módulo está presente na sua instalação digitando pacmd em seu terminal, listando todos os módulos presentes pelo comando list-modules e procurando por module-echo-cancel. Não está presente? Você precisa adicionar algumas linhas ao arquivo de texto responsável pela configuração do PulseAudio.

Com o seu editor favorito, abra (com privilégios de administrador) o arquivo /etc/pulse/ e adicione as seguintes linhas ao fim do arquivo:

### Enable Echo/Noise-Cancellation
load-module module-echo-cancel use_master_format=1 aec_method=webrtc aec_args="analog_gain_control=0\ digital_gain_control=1" source_name=echoCancel_source sink_name=echoCancel_sink
set-default-source echoCancel_source
set-default-sink echoCancel_sink

Phoenix 1.4.x to 1.5.0 upgrade instructions

Phoenix 1.5 requires Elixir >= 1.7. Be sure your existing version is up to date by running elixir -v on the command line.

Install the new project generator

$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.5.0
keathley / .credo.exs
Last active Nov 22, 2021
Keathley's credo file
View .credo.exs
# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub:
# You can have as many configs as you like in the `configs:` field.
configs: [
carterbryden / AddPostgresTriggerAndFunctionForAllTables.exs
Last active Aug 5, 2021
Elixir Phoenix Postgresql migration to add triggers for pubsub to run on every CRUD operation on every table. If a new table is added, it'll automatically add a trigger to that table too.
View AddPostgresTriggerAndFunctionForAllTables.exs
defmodule MyApp.Repo.Migrations.AddPostgresTriggerAndFunctionForAllTables do
use Ecto.Migration
def up do
# Create a function that broadcasts row changes
execute "
CREATE OR REPLACE FUNCTION broadcast_changes()
RETURNS trigger AS $$
current_row RECORD;