Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Pre-commit hook for git which removes trailing whitespace, converts tabs to spaces, and enforces a max line length.
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@ltfschoen
ltfschoen / bulletproof-git-workflow.md
Last active January 18, 2017 23:34 — forked from db/bulletproof-git-workflow.md
bulletproof git workflow

Bulletproof Git Workflow

start working

git checkout master
git pull
git checkout -b feature/my-work
# edit your files
@ltfschoen
ltfschoen / clean-docker-for-mac.sh
Created June 1, 2017 22:20 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# 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 furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@ltfschoen
ltfschoen / rvm2rbenv.txt
Last active August 8, 2017 13:36 — forked from brentertz/rvm2rbenv.txt
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
sudo rm -rf /Users/<your_username>/.rvm/
# Remove RVM from ~/.bash_profile and ~/.bash_rc
# Ensure your homebrew is working properly and up to date
brew doctor
@ltfschoen
ltfschoen / pr.md
Created October 21, 2017 09:57 — forked from houjunchen/pr.md
Checkout Bitbucket Server pull requests locally

Locate the section for your Bitbucket Server remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@<your repo url>

Now add the line fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

import collections
import random
import json
import hashlib
def hexhash(x):
return '0x' + hashlib.sha224(str(x)).hexdigest()[:6]
// MIT
const React = window.React;
const { Component } = React;
const PRICE_URL = 'https://api.etherscan.io/api?module=stats&action=ethprice';
const PRICE_OPTIONS = {
method: 'GET',
mode: 'cors',
headers: {
@ltfschoen
ltfschoen / map_to_query_string.ex
Created January 28, 2018 08:57 — forked from desmondhume/map_to_query_string.ex
Convert elixir map to query string
defmodule URL do
def to_query(input, namespace) do
Enum.map(input, fn({key, value}) -> parse("#{namespace}[#{key}]",value)end)
|> Enum.join("&")
end
def to_query(input) do
Enum.map(input, fn({key, value}) -> parse(key,value) end)
|> Enum.join("&")
end
@ltfschoen
ltfschoen / setup.sh
Created August 11, 2018 16:21 — forked from bradp/setup.sh
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@ltfschoen
ltfschoen / string-conversion.rs
Created November 8, 2021 09:55 — forked from jimmychu0807/string-conversion.rs
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte