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
############################################################################### | |
# Kubernetes Shortcuts ######################################################## | |
############################################################################### | |
# Shell functions and aliases for common things I do with kubectl (Kubernetes, | |
# K8s) | |
# | |
# A lot of the below makes the following assumptions: | |
# - That you have separate staging and production clusters or a similar | |
# arrangement |
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
/** | |
* Converts passed slug to capitalized display value. Not super clever, just | |
* intended to deal with lowercase, dashed slugs. Ex.: bananas-in-pajamas --> | |
* Bananas In Pajamas | |
* | |
* @param {String} slug Slug to convert to display text | |
* | |
* @return {String} Returns formatted text | |
*/ | |
function slugToDisplay ( slug ) { |
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
<Tag>(.|\s)*?</Tag> |
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
Find: function \((\s)?(.*)(\s)?\) { | |
Replace: ($1$2$3) => { |
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
/** | |
* Given a raw phone number, parse out individual components. | |
* | |
* @param {String} raw Raw phone number to parse | |
* | |
* @return {Object} Returns object containing countryCode, areaCode, officeCode | |
* and stationNumber components | |
*/ | |
function getPhoneNumberComponents ( raw ) { | |
// First cut raw string down to just numbers |
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
/(\d{1,3})?(\s|-|\.)?\(?(\d{3})?\)?(\s|-|\.)?(\d{3})(\s|-|\.)?(\d{4})/.exec( string ); |
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
/** | |
* Return total byte size of all current keys in localStorage. Based on | |
* UTF-8 encoding for byte size, so not guaranteed to be accurate in | |
* other encodings. | |
*/ | |
localStorage.__proto__.size = function () { | |
return Object.keys( this ) | |
.map( function ( key ) { | |
return ( new TextEncoder( 'utf-8' ).encode( localStorage[ key ] ) ).length; | |
}) |
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
# Hide icons | |
defaults write com.apple.finder CreateDesktop -bool false && killall Finder | |
# Show icons | |
defaults write com.apple.finder CreateDesktop -bool true && killall Finder |
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
moment.tz( 'US/Eastern' ).set({ hours: moment().hours() }); |
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
/** | |
* Split a credit card into groups of four for more readable display. | |
* | |
* @param {Integer} number Number to split | |
* | |
* @return {String} Returns formatted number for display | |
*/ | |
function splitCardNumber ( number ) { | |
return number | |
.toString() |
NewerOlder