Skip to content

Instantly share code, notes, and snippets.

@efrenfuentes
efrenfuentes / alpine-js-fetch-data-on-x-init.markdown
Created September 13, 2021 20:18 — forked from marcus-at-localhost/alpine-js-fetch-data-on-x-init.markdown
[Alpine.js fetch data on `x-init`] #js #alpinejs
@efrenfuentes
efrenfuentes / my_app.ex
Created May 19, 2020 15:35 — forked from alanpeabody/my_app.ex
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@efrenfuentes
efrenfuentes / gcd_and_lcm.py
Created March 28, 2020 21:45 — forked from endolith/gcd_and_lcm.py
GCD and LCM functions in Python for several numbers
# Greatest common divisor of 1 or more numbers.
from functools import reduce
def gcd(*numbers):
"""
Return the greatest common divisor of 1 or more integers
Examples
--------
@efrenfuentes
efrenfuentes / rename_phoenix_project.sh
Created December 20, 2019 20:54 — forked from krystofbe/rename_phoenix_project.sh
rename a phoenix 1.3 project
#!/bin/bash
set -e
CURRENT_NAME="Zauberantrag"
CURRENT_OTP="zauberantrag"
NEW_NAME="Wunderantrag"
NEW_OTP="wunderantrag"
@efrenfuentes
efrenfuentes / Phoenix JWT.md
Created December 13, 2019 13:26 — forked from odyright/Phoenix JWT.md
Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

Elixir + Phoenix Framework 1.3 + Guardian + JWT(Refresh, Revoke, Recover) + Comeonin

User model bootstrap

Let's generate User model and controller.

mix ecto.create
mix phoenix.gen.json Accounts User users email:string password_hash:string
@efrenfuentes
efrenfuentes / bancos
Created October 11, 2019 13:42 — forked from xombra/bancos
Codigo y Bancos correspondientes de Venezuela
Banco:
<select name="banco">
<option value=""></option>
<option value="0156">100%BANCO</option>
<option value="0196">ABN AMRO BANK</option>
<option value="0172">BANCAMIGA BANCO MICROFINANCIERO, C.A.</option>
<option value="0171">BANCO ACTIVO BANCO COMERCIAL, C.A.</option>
<option value="0166">BANCO AGRICOLA</option>
<option value="0175">BANCO BICENTENARIO</option>
<option value="0128">BANCO CARONI, C.A. BANCO UNIVERSAL</option>

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@efrenfuentes
efrenfuentes / main.go
Created June 5, 2018 00:53 — forked from walm/main.go
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@efrenfuentes
efrenfuentes / md5-example.go
Created May 12, 2018 00:10 — forked from sergiotapia/md5-example.go
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@efrenfuentes
efrenfuentes / install.sh
Created October 1, 2017 16:34 — forked from swelham/install.sh
Install Elixir on c9.io
sudo touch /etc/init.d/couchdb
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get -y install elixir erlang-dev
rm erlang-solutions_1.0_all.deb