Skip to content

Instantly share code, notes, and snippets.

View sturoid's full-sized avatar

Stuart Clove sturoid

  • St. George, Utah
View GitHub Profile
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
@sturoid
sturoid / gist:bfc62b066c181579d09db39b0b52a90b
Last active November 25, 2019 21:40
Find if all leaves of tree are equal.
const sampleTree = {
a: 1,
b: 1,
c: {
d: 1,
e: 1
},
f: 1,
g: {
h: {
/*
Complete the urlencode() function, which should take a javascript object and return a PHP-style query string [1].
The object should be translated into a sequence of <key>=<value> pairs, separated by &.
Reserved characters in keys and values should be percent encoded [2].
If a nested object is encountered it should be added to the output as <top level key>[<sub key]=<value>
There are a number of test-cases defined below, correctness of the function can be tested by running this file:
Select all of the same word - ctrl+cmd+g
@sturoid
sturoid / sublime-preferences
Created June 21, 2014 00:10
sublime preferences
{
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"fade_fold_buttons": false,
"font_face": "Inconsolata",