Skip to content

Instantly share code, notes, and snippets.

View leunardo's full-sized avatar
:shipit:

Leonardo Alves leunardo

:shipit:
View GitHub Profile
@leunardo
leunardo / Microsoft.PowerShell_profile.ps1
Last active February 6, 2020 13:28
Powershell with bash prompt
# 1. Open %USERPROFILE%/Documents
# 2. Create a folder called "WindowsPowerShell"
# 3. Drop this file inside this folder
# 4. Open a new PowerShell with Admin Privileges
# 5. Run this script to allow unsigned scripts: Set-ExecutionPolicy Unrestricted
function prompt {
$location = (Get-Location).ToString()
$location = $location.Replace($env:USERPROFILE, "~")
@leunardo
leunardo / .gitconfig
Last active February 17, 2020 11:47
Git Aliases
[alias]
# stash; checkout; pop
# git scp ->
# git stash; git checkout -; git stash pop;
scp = !git stash && git checkout - && git stash pop
# stash; checkout specific; pop
# git scsp myBrach ->
# git stash; git checkout myBranch; git stash pop;
scsp = !git stash && git checkout $1 && git stash pop && :
@leunardo
leunardo / log.js
Last active September 27, 2019 21:26
APIs Assíncronas no Javascript
const success = (value) => {
console.log(`Promise succeeded with ${value}`);
}
const error = (err) => {
console.error(`Promise failed with ${err}`);
}
@leunardo
leunardo / read_from_sql.py
Created August 21, 2019 01:00
Python pyodbc + pandas dataframe
# python 3.6+
import pandas as pd
from pyodbc import connect as connect_to_db
# database variables
sql_server = 'test'
database = 'test'
username = 'user'
password = 'password'
@leunardo
leunardo / pipe.js
Last active July 2, 2019 01:57
JS Pipe (rxjs-like)
function removeFalsyValues(values) {
return values.filter(value => Boolean(value));
}
function showValues(values) {
values.forEach(value => console.log(`Got value: ${value}`));
}
function greaterThanZero(values) {
return values.filter(value => value > 0);