Skip to content

Instantly share code, notes, and snippets.

View ardydedase's full-sized avatar
🏠
Working from home

Ardy Gallego Dedase ardydedase

🏠
Working from home
View GitHub Profile
@ardydedase
ardydedase / gist:2411431
Created April 18, 2012 06:20
JavaScript: jQuery HTML Decoder/Encoder
function htmlEncode(value){
    if (value) {
        return jQuery('<div />').text(value).html();
    } else {
        return '';
    }
}
 
function htmlDecode(value) {
    if (value) {
@ardydedase
ardydedase / gist:2418152
Created April 19, 2012 03:17
CSS: Cross-browser gradient
background: #40464e;
background-image: -khtml-gradient(linear, left top, left bottom, from(#40464e), to(#2d333b));
background-image: -moz-linear-gradient(top, #40464e, #2d333b);
background-image: -ms-linear-gradient(top, #40464e, #2d333b);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #40464e), color-stop(100%, #2d333b));
background-image: -webkit-linear-gradient(top, #40464e, #2d333b);
background-image: -o-linear-gradient(top, #40464e, #2d333b);
background-image: linear-gradient(top, #40464e, #2d333b);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#40464e', endColorstr='#2d333b', GradientType=0);
@ardydedase
ardydedase / shell list image files
Created May 17, 2012 17:46
list image files using grep/awk
grep . htdocs/resources/img/migazine/*.png htdocs/resources/img/migazine/*.jpg htdocs/resources/img/migazine/*.gif | awk '{ print $3 }'
@ardydedase
ardydedase / gist:3797787
Created September 28, 2012 03:26
Shell: Check if 64 or 32 Bit CentOS
uname -a
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
@ardydedase
ardydedase / gist:5326146
Created April 6, 2013 13:36
Create symlink to a bunch of folders
for i in ~/vagrant/webinabox/projects/*;
do
app=${i/\/Users\/ardydedase\/vagrant\/webinabox\/projects\/};
echo $app;
ln -s $i $app;
done;
@ardydedase
ardydedase / rename_files_append.sh
Created April 8, 2013 02:29
Rename and create a copy of a bunch of files by appending a string at the end of the filename.
h=12;for i in *_$h.png; do noext=${i/\.png}; cp $i $noext"x$h.png"; done;
@ardydedase
ardydedase / rename_files.sh
Created April 8, 2013 02:49
Rename a bunch of files.
for i in *_12x12.png; do noext=${i/migPa}; noext=${noext/\.png}; echo $noext; echo $i; mv $i $noext".png"; done;
@ardydedase
ardydedase / gist:5720526
Last active December 18, 2015 03:48
Uninstall brew (so I can reinstall)
cd `brew --prefix`
rm -rf Cellar
brew prune
rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
rm -rf ~/Library/Caches/Homebrew
@ardydedase
ardydedase / linux_mem_usage.sh
Created November 11, 2015 13:37
linux_mem_usage
$(ps -C httpd -O rss | gawk '{ count ++; sum += $2 }; END {count --; print sum/1024 ;};')