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
#!/bin/sh | |
hist=$(history | tail -1 | awk '{ print $1 }'); history -d $hist; history -d $(expr $hist - 1); unset hist |
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
# ----------------------------------------- | |
# list out all directories included in $PATH | |
# | |
# @1 = separator (New line by default) | |
# -> Example usage: | |
# paths-ls ' ' | |
# ----------------------------------------- | |
function paths-ls() { | |
if [ -z "$1" ]; then | |
local SEP="\n" |
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
# ----------------------------------------- | |
# count the number of lines in a string as variable | |
# | |
# @1 = string | |
# ----------------------------------------- | |
function count-new-lines() { | |
if [ -z "$1" ]; then | |
echo "Must provide string as variable.." | |
return | |
else |
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
# ----------------------------------------- | |
# Trim string | |
# | |
# @1 = string | |
# ----------------------------------------- | |
function trim () { | |
local s2 s="$*" | |
# note the tab character in the expressions of the following two lines when copying | |
until s2="${s#[ ]}"; [ "$s2" = "$s" ]; do s="$s2"; done | |
until s2="${s%[ ]}"; [ "$s2" = "$s" ]; do s="$s2"; done |
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
/** | |
* Helper String Methods/Extensions to the JS String Object | |
* | |
* @param String search | |
* @return Bool | |
*/ | |
/* Easier way to check if a string contains a substring */ | |
String.prototype.contains = String.prototype.contains || function(search) { | |
return (this.indexOf(search) !== -1); |
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 camelCase string to lowercase string with dashes (pretty permalink style ;-) | |
* | |
* @return String | |
*/ | |
String.prototype.camelCaseToDashed = function() { | |
return this.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase(); | |
}; |
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 with dashes to camel case | |
* | |
* @return String | |
*/ | |
String.prototype.dashToCamelCase = function() { | |
return this.replace(/-([a-z])/g, function(g) { | |
return g[1].toUpperCase(); | |
}); | |
}; |
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 font to specified font types using ruby gem 'convert_font' | |
# | |
# @1 = Font to convert (e.g. 'fonts/ComicSansMS.ttf') | |
# @2 = Font types to convert to (e.g 'svg,woff') | |
# ----------------------------------------- | |
function convert-a-font() { | |
if [[ $(command -v convert_font) = "" ]]; then | |
echo "Ruby gem 'convert_font' must be installed." | |
if [[ $(command -v gem) = "" ]]; then |
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
# LOAD UPLOADS FROM STAGE/PRODUCTION | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /wp-content/uploads/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# Rewrite local to stage | |
RewriteCond %{HTTP_HOST} ^example\.dev$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://example.stage.com/wp-content/uploads/$1 [L] | |
RewriteCond %{HTTP_HOST} ^example\.dev$ | |
RewriteRule ^wp-content/uploads/(.*)$ http://example.stage.com/wp-content/uploads/$1 [L] |
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
## ----------------------------------------- | |
# Return any and all paths and/or symlinks of a command | |
# | |
# @1 = command name | |
## | |
function which-all () { | |
if [[ -z "$1" ]]; then | |
echo "Script name or file path?" | |
read SCRPTNAME |