Skip to content

Instantly share code, notes, and snippets.

View cassaram09's full-sized avatar

Matt Cassara cassaram09

View GitHub Profile
@cassaram09
cassaram09 / new_tab_with_directory.sh
Last active August 20, 2020 16:59
Open a new tab in Iterm2 with current directory
# Add these functions to your Bash profile.
# Copies the current directory to the clipboard
function cwd {
pwd | pbcopy
}
# Changes the current directory, after new tab has been loaded
function chwd {
DIR=`pbpaste`
@cassaram09
cassaram09 / deepClone.js
Last active October 12, 2021 06:22
JavaScript deep clone function
function deepClone(source){
// If the source isn't an Object or Array, throw an error.
if ( !(source instanceof Object) || source instanceof Date || source instanceof String) {
throw 'Only Objects or Arrays are supported.'
}
// Set the target data type before copying.
var target = source instanceof Array ? [] : {};
for (let prop in source){
@cassaram09
cassaram09 / loadGoogleMaps.js
Created September 13, 2017 21:58
tool to load Google Maps API
import load from "little-loader";
import qs from "query-string";
// YOUR_API_KEY - string
// libraries - array of strings, eg ['places']
const loadGoogleMaps = (YOUR_API_KEY, libraries) => {
return new Promise( (resolve, reject) => {
var params = {key: YOUR_API_KEY, libraries: libraries}