Skip to content

Instantly share code, notes, and snippets.

View ryanvazquez's full-sized avatar

Ryan Vazquez ryanvazquez

  • New York, New York
View GitHub Profile
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active November 4, 2024 04:14
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@ryanvazquez
ryanvazquez / setIntervalTimeout.js
Last active April 15, 2022 16:22
Simple utility for creating variadic intervals
// setIntervalTimeout sits somewhere between setTimeout and setInterval,
// allowing a finite or infinite number of fixed or variadic intervals.
// Returns a cleanup function to clear the current timeout.
// Note: IE does not support generators.
function setIntervalTimeout(callback, iterable, ...args){
if (!(Symbol.iterator in iterable)){
throw new Error(`Expected valid iterable. Received: ${iterable}.`);