Skip to content

Instantly share code, notes, and snippets.

View leobessa's full-sized avatar

Leonardo Bessa leobessa

View GitHub Profile
@bodhi
bodhi / Dockerfile
Created May 22, 2019 00:18
Burn git commit SHA into docker image
FROM golang:1.12 AS build
COPY ./main.go .
# ARG here is to make the sha available for use in -ldflags
ARG GIT_SHA
# -ldflags "-X main.sha=${GIT_SHA}" allows main.sha to be set at build time
RUN go build -ldflags "-X main.sha=${GIT_SHA}" -o /app
FROM scratch
@simonmichael
simonmichael / pricing.ledger
Created May 14, 2019 15:09
Testing ledger cost/price syntax, lots, revaluation, capital gains
; Test ledger cost/price syntax, lots, revaluation, capital gains
P 2019-01-01 ETC 11 EUR
P 2019-02-01 ETC 12 EUR
; Fluctuating cost/price
; @, @@ https://www.ledger-cli.org/3.0/doc/ledger3.html#Posting-cost
; { }, {{ }} https://www.ledger-cli.org/3.0/doc/ledger3.html#Commodity-prices
; "functionally.. no difference" https://www.ledger-cli.org/3.0/doc/ledger3.html#Prices-versus-costs
@josephan
josephan / setup_tailwind_in_phoenix.md
Last active August 8, 2023 05:50
Add Tailwind CSS to an Elixir/Phoenix Project with PurgeCSS
@kaysiz
kaysiz / occupation-dropdown.html
Created January 19, 2019 13:38 — forked from ag14spirit/occupation-dropdown.html
Form occupation drop down list
<fieldset>
<legend>Occupation</legend>
<select class="form-control dropdown" id="occupation" name="occupation">
<option value="" selected="selected" disabled="disabled">-- select one --</option>
<optgroup label="Healthcare Practitioners and Technical Occupations:">
<option value="1">- Chiropractor</option>
<option value="2">- Dentist</option>
<option value="3">- Dietitian or Nutritionist</option>
<option value="4">- Optometrist</option>
<option value="5">- Pharmacist</option>
@sillasgonzaga
sillasgonzaga / api_quotas_fundos.R
Last active June 15, 2023 13:17
API para baixar quotas de fundos
library(httr)
library(magrittr)
library(xml2)
library(rvest)
url_raw <- "http://dados.cvm.gov.br/dados/FI/DOC/INF_DIARIO/DADOS/"
output_file <- "fundos/api/informe_diario.csv"
csv_links <- httr::GET(url_raw) %>%
httr::content("text") %>%
@nicbet
nicbet / _Webpack-Fontawesome-Bootstrap-Phoenix.md
Last active April 28, 2020 05:43
Sass versions of Bootstrap 4 and Fontawesome 5 with Elixir / Phoenix Framework 1.3.x and 1.4.x using Webpack

SASS Versions of

  • Fontawesome 5
  • Bootstrap 4

in Phoenix 1.3 and 1.4 via Webpack

@anthonytxie
anthonytxie / hodl20.py
Created March 24, 2018 21:01
Hodl 20 Rebalancing Algorithm
def calc_allocations(self, date, quantity, cap):
"""Figure out ideal allocations for a given date"""
# {
# coin_name: (percent_allocation, data)
# }
top_market = self.get_top_market(date, quantity)
total_cap = sum([coin.market_cap for coin in top_market])
allocations = [{
@agarrharr
agarrharr / index.md
Last active December 27, 2023 18:18
Common Ledger CLI Commands

Common Ledger CLI Commands

  • Income vs expenses this month?

    $ ledger balance income expenses --period "this month"
  • What did my budget look like at a certain date?

@mmcc
mmcc / authed_conn_case.ex
Last active October 26, 2023 00:05
Elixir test macros
defmodule AppWeb.AuthConnCase do
alias AppWeb.Router
use ExUnit.CaseTemplate
import Phoenix.ConnTest, only: [dispatch: 5, json_response: 2]
@doc """
Allows you to call the same set of tests with the same describe block
Setups is an array of named setups, i.e. [first_setup: [:setup_conn, :thing], second_setup: [:different_setup, :neato_setup]]
## Examples
@egaleme
egaleme / gist:7b4d35334bb1f926422f8210b5b85fab
Last active September 2, 2021 21:47
How to create a user authentication systems with email verification in phoenix framework
# How to create a user authentication systems with email verification in phoenix framework.
Phoenix Framework is built with the powerful and resilient programming language called Elixir Lang. It is gaining momentunm by the day thanks to it's expressive sytanx which makes you productive and it's built upon the shoulders of the Erlang vm called BEAM which makes your code performant.
Here will build a user registration with Email verification and a login systems. Phoenix framework can be used to build normal html 5 crud apps, json api and real time backends. We'll be building a real time backend using Phoenix channels and an Elixir library Guardian jwt.
You can find installation instructions on the [Elixir site](http://elixir-lang.org) and [Phoenix framework](http://phoenixframework.org) .
We be using Phoenix 1.3 which is the current version.