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
<style> | |
.loading-animation { | |
position: fixed; | |
top: 50%; | |
left: 50%; | |
margin-left: -50px; | |
width: 100px; | |
height: 80px; | |
text-align: center; | |
background-color: #fff; |
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/bash | |
[[ ! -d ~/.bash_alias ]] && mkdir -p ~/.bash_alias | |
# path to individual alias files | |
APATH=~/.bash_alias | |
ALIASPATH=$APATH | |
AFILES=($APATH/*.sh) | |
ALIASFILES=$AFILES |
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
/*! | |
* DOM element spawner with *optional* jQuery functionality | |
* | |
* EXAMPLES: | |
* var p1 = spawn('p|id:p1', 'Text for paragraph 1.'); | |
* var div2 = spawn('div|class=div2', ['Text for div2.', p1]) // inserts text and puts p1 inside div2 | |
* var ul1 = spawn('ul', [['li', 'Content for <li> 1.'], ['li', 'Content for the next <li>.']]); | |
* div2.appendChild(ul1); // add ul1 to div2 | |
*/ |
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/bash | |
FILE=/home/user/src/prog.c | |
echo ${FILE#/*/} # ==> user/src/prog.c | |
echo ${FILE##/*/} # ==> prog.c | |
echo ${FILE%/*} # ==> /home/user/src | |
echo ${FILE%%/*} # ==> nil | |
echo ${FILE%.c} # ==> /home/user/src/prog | |
# All this from the excellent book: "A Practical Guide to Linux Commands, Editors, and |
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/bash | |
# The function below will recursively search parent folders | |
# from the current folder (or specified starting folder) | |
# until it finds a matching file or folder, then returns | |
# the full absolute path to that file or folder. | |
# | |
# Run this script where it's stored or call the 'getFilePath' function | |
# if included as a source in another script. | |
# |
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
/*! | |
* Create HTML elements from a config object | |
* https://gist.github.com/Error601/7a86fa6e34fbc98b31a6 | |
*/ | |
if (typeof jQuery == 'undefined') { | |
throw new Error('jQuery is required'); | |
} | |
(function($, undefined){ |
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
/*! | |
* Robust string conversion between | |
* hyphenated 'text-string' and | |
* camelCase 'textString'. | |
* Allows use of '_' (underscore), | |
* ' ' (space), '.' (period), and | |
* '-' (hyphen) as word delimiters, | |
* or an array of words. | |
*/ |
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
/*! | |
* Global general-purpose JavaScript convenience | |
* utlity helper functions, because the world | |
* needs yet ANOTHER JavaScript library for | |
* things that should just be native JavaScript | |
* methods in the first place! | |
* | |
* Some of these functions are taken straight from | |
* other libraries and transplanted here - thus | |
* the name 'locash' - a nod to lodash/underscore |
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 the first defined value from argument | |
* list. Vars must be declared before passing | |
* to the function - set equal to self to catch | |
* any existing value for that var name. Useful | |
* for fetching values from an outer scope that | |
* may or may not be defined yet, while providing | |
* a fallback of a known (explicitly) defined value. | |
* | |
* // vars declared and assigned to self |
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
/*! | |
* Get or set [data-] attributes and | |
* keep jQuery's .data object in sync | |
* with those attributes with special | |
* handling for non-string data and | |
* proper retrieval of functions stored | |
* in jQuery's .data object. | |
*/ |
NewerOlder