Skip to content

Instantly share code, notes, and snippets.

Coding time

Vinicius Souza vsouza

Coding time
View GitHub Profile
KronicDeth /
Created Sep 22, 2017
Recap of all talks at ElixirConf 2017

Elixir Native UI - Boyd Multerer

Thinking In Ecto - Darin Wilson

  1. Repository pattern
  2. Explicitness
matryer / term_context.go
Last active Sep 28, 2020
Making Ctrl+C termination cancel the context.Context
View term_context.go
func main() {
ctx := context.Background()
// trap Ctrl+C and call cancel on the context
ctx, cancel := context.WithCancel(ctx)
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
defer func() {
bmhatfield / .zshrc
Last active Apr 18, 2021
OSX Keychain Environment Variables
View .zshrc
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
lucasrcosta /
Last active Feb 20, 2019
Tornado Handler Thread Decorator
from concurrent.futures import ThreadPoolExecutor
from datetime import timedelta
from tornado import gen
from tornado.concurrent import run_on_executor
def onthread(function):
vsouza / request.swift
Last active May 31, 2016
Simple HTTP request. Swift backend implementation
View request.swift
import HTTP
import File
import HTTPSClient
import JSON
var url: String?
do {
let client = try! Client(uri: "")
var response = try client.get("/repos/vsouza/awesome-ios/git/trees/HEAD")
let buffer = try response.body.becomeBuffer()
mixxorz /
Last active Apr 24, 2021
Get requested fields from ResolveInfo. Graphene python.
MIT License
Copyright (c) 2018 Mitchel Cabuloy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
import pandas as pd
data = {'a': [1, 3, 4, 4], 'b': [1, 3, 2, 3]}
df = pd.DataFrame(data=data)
data2 = {'a': [1, 3, 5, 4], 'b': [1, 3, 2, 3]}
df2 = pd.DataFrame(data=data2)
madhums / gin_html_render.go
Last active Mar 15, 2021
render html templates in gin (go)
View gin_html_render.go
// Package GinHTMLRender provides some sugar for gin's template rendering
// This work is based on gin contribs multitemplate render
// Usage
// router := gin.Default()
// // Set html render options
// htmlRender := GinHTMLRender.New()
patik /
Last active Apr 23, 2021
How to squash commits in git

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:

harlow /
Last active May 11, 2021
Job queues in Golang