This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# Xcode # | |
#################### | |
# Function to open Xcode projects from the command line, call with $ xcode (BASH version) | |
# Bash friendly version | |
function xcode { | |
proj=$( ls -d *.xcodeproj/ 2>/dev/null ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# C++ # | |
#################### | |
# Function to compile and run c++ files from the command line, call with $ cpp filename | |
# Compiling and running c++ files with | |
# $ make filename && ./filename is overly verbose | |
# This function lessens on the typing required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.zshrc | |
# Override auto-title when static titles are desired ($ title My new title) | |
title() { export TITLE_OVERRIDDEN=1; echo -en "\e]0;$*\a"} | |
# Turn off static titles ($ autotitle) | |
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle | |
# Condition checking if title is overridden | |
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; } | |
# Echo asterisk if git state is dirty | |
gitDirty() { [[ $(git status 2> /dev/null | grep -o '\w\+' | tail -n1) != ("clean"|"") ]] && echo "*" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Zero pad the gutter numbers in Atom for a cleaner look. */ | |
// loop through 1 - 9 | |
@iterations: 8; | |
.double-zero-pad (@i) when (@i >= 0) { | |
.line-number[data-buffer-row="@{i}"]::before, | |
.git-line-removed[data-buffer-row="@{i}"]::before { content: '00' !important } | |
.double-zero-pad(@i - 1); | |
} .double-zero-pad (@iterations); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Convert string of roman numerals to an integer ### | |
convertSingleChar = (romanNumeral) -> | |
switch romanNumeral | |
when "I" then 1 | |
when "V" then 5 | |
when "X" then 10 | |
when "L" then 50 | |
when "C" then 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### ---------- CLEAN WRAP GUIDE ---------- | |
The ergonomic factors of code readiablity include a preferred line length limit. | |
Automatic soft wrap is a nightmare because it hinders the "write first, refactor later" | |
mentality because it wrecks readability, an unusually long line is just a minor annoyance. | |
A wrap guide is a visual cue showing you if cleanup is necessary at a later point. | |
The problem: having a wrap guide visible at all times is distracting visual noise. | |
This script toggles the visibility of the wrap guide if a line exceeds the preferred line length. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fibonacci = length => { | |
const fibSeq = [1, 1]; | |
if(length < 2) return fibSeq.splice(length, length); | |
for(let i = 2; i < length; i++) fibSeq.push(fibSeq[i-2] + fibSeq[i-1]); | |
return fibSeq; | |
} | |
console.log(fibonacci(50)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(i=1;i<101;i++) | |
o =i%3?'':'Fizz', | |
o+=i%5?'':'Buzz', | |
console.log(o||i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ObjFromArr = (arr) => Object.assign {}, ...arr.map (item) => item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSSStyleDeclaration.prototype.setProps = function(props) { | |
for (const prop in props) this.setProperty(prop, props[prop]); | |
} | |
/* | |
CONTEXT: | |
I'm usually not a proponent of setting styles through js, but I've recently | |
discovered that you can modify CSS variables with JS, which is YUUGE. |
OlderNewer