This file contains hidden or 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
| """ | |
| Naive camel-to-snake converter | |
| Assumes input to be valid camel case | |
| """ | |
| def camel_to_snake(text): | |
| new_text = '' | |
| for index in range(0, len(text)): | |
| next_char = text[index] |
This file contains hidden or 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
| alias refresh='. ~/.bash_profile' | |
| alias bashx='nano ~/.bash_profile' | |
| alias ll='ls -alh' | |
| alias fork='open -a Fork .' | |
| alias sa='cd /Users/ekarp/Development/sa' | |
| alias cms='cd /Users/ekarp/Development/smartcms' | |
| alias sam='cd /Users/ekarp/Development/smartadvisormatch' | |
| alias branches='bash ~/branches.sh' |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # Delete all merged branches | |
| git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d; | |
| # Display remaining branches | |
| git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:red)%(refname:short)|%(color:magenta)%(committerdate:relative)|%(color:blue)%(authorname)%(color:reset)|%(subject)' | | |
| sed 's/refs\/heads\///g' | | |
| grep -v BACKUP | | |
| while IFS='|' read branch date author message |
This file contains hidden or 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 capitalize = originalSentence => | |
| { | |
| return originalSentence.toLowerCase().split(' ').reduce((sentence, word) => | |
| { | |
| let wordArray = word.split(/\b(\w)/); | |
| if (wordArray.length) | |
| { | |
| wordArray[1] = wordArray[1].toUpperCase(); |
This file contains hidden or 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
| [alias] | |
| last = show --stat --oneline | |
| story = log --decorate --pretty=format:'%C(Yellow)%h%Creset %Cred%cd%Creset %Cblue%s%Creset%C(magenta)%d%Creset' --date=local | |
| # These are also useful with --grep=<ticket number> | |
| sa = log --decorate --pretty=format:'%C(Yellow)%h%Creset %<(15)%Cred%cd%Creset %<(17)%an %Cblue%s%Creset %C(magenta)%d%Creset' --date=relative --no-merges | |
| rev = log --decorate --pretty=format:'%C(Yellow)%h%Creset %<(15)%Cred%cd%Creset %<(17)%an %Cblue%s%Creset %C(magenta)%d%Creset' --date=relative --no-merges --stat | |
| code = log --decorate --pretty=format:'%C(Yellow)%h%Creset %<(15)%Cred%cd%Creset %<(17)%an %Cblue%s%Creset %C(magenta)%d%Creset' --date=relative --no-merges -p | |
| # View local branches with extra info |
This file contains hidden or 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
| function createTimer() { | |
| var start = (new Date()).valueOf()/1000; | |
| return { | |
| timestamp: function() { | |
| var stamp = Math.floor((new Date()).valueOf()/1000 - start); | |
| console.log('Timestamp:', stamp, 'seconds.', [].slice.call(arguments).join(' ')); | |
| } | |
| } |
This file contains hidden or 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
| /** | |
| * Class WPDocs_New_Widget | |
| * https://github.com/KingPixil/wing/tree/master/src | |
| */ | |
| class Three_Columns extends WP_Widget { | |
| function __construct() { | |
| // Instantiate the parent object. | |
| parent::__construct( false, __( 'Three Columns', 'textdomain' ), array( |
This file contains hidden or 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
| // Chrome snippet to combine the text of short adjacent paragraphs | |
| // for a more fluid reading experience | |
| (function long() { | |
| var paragraphs = document.getElementsByTagName('p'); | |
| for (var i=1; i<paragraphs.length; i++) { | |
| var prev = paragraphs[i-1]; | |
| var pElem = paragraphs[i]; | |
This file contains hidden or 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
| @mixin resizeImageY($x) { | |
| width: 100%; | |
| clip-path: inset(0 0 $x 0); | |
| -webkit-clip-path: inset(0 0 $x 0); | |
| margin-bottom: -$x; | |
| } | |
| @mixin resizeImageX($x) { | |
| $half: $x/2; | |
| clip-path: inset(0 $half+px 0 0); |
This file contains hidden or 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
| gitlog() { | |
| c="git log --all --decorate --graph --pretty=format:%C(Yellow)%h%Creset_%Cred%cd%Creset_%Cblue%s%Creset%C(magenta)%d%Creset --date=local" | |
| $c | |
| } | |
| # Use function 'datecode' (with optional date arg yyyy-mm-dd) | |
| datestamp() { | |
| date +"%Y-%m-%d" |