Skip to content

Instantly share code, notes, and snippets.

View thegitfather's full-sized avatar

thegitfather thegitfather

View GitHub Profile
@thegitfather
thegitfather / jquery.randomize.js
Created January 20, 2016 23:12
randomize dom elements
/* Usage:
$('button').click(function() {
$("div.band").randomize("div.member");
});
*/
(function($) {
@thegitfather
thegitfather / totalmem.sh
Last active January 24, 2016 23:06
return the total physical memory usage (in MB) of all process with a given name usage: $ ./totalmem.sh chrome
#!/bin/bash
BASENAME=`basename "$0"`
TOTALMEM=0
if (( "$#" == 1 )); then
while read -r line; do
temp=$(echo "$line" | grep $1 | grep -o -E "[0-9]{2,}")
TOTALMEM=$(( $temp+$TOTALMEM ))
done < <(ps -eo comm,rsz ) # process substitution
@thegitfather
thegitfather / test-examples.sh
Last active August 29, 2015 14:25
bash test examples
#!/bin/bash
# test if some command exists - like 'curl'
command -v curl >/dev/null 2>&1 || { echo "please make sure curl is properly installed. aborting..." >&2; exit 1; }
echo "ok all fine. proceeding..."
exit 0
# test if file exits
if [ -f "$HOME/.bash/bash_aliases.sh" ]; then
source "$HOME/.bash/bash_aliases.sh"
@thegitfather
thegitfather / compass.scss
Last active August 29, 2015 14:02
compass mixin background ellipse + fallback
@include background(image-url("foo.png"),
radial-gradient(center,ellipse cover,rgba(0,0,0, 0.4) 0, rgba(0,0,0, 0.9) 100%));