View wp_add_preload_resource_hint.php
// Adds preload resource hint to wp_head hook | |
add_action( 'wp_head', 'add_preload_resource_hint', -1); | |
/** | |
* Writes preload resource hints. | |
* | |
* Writes preload resource hints. | |
*/ | |
function add_preload_resource_hint() { |
View byte-to-units.js
// https://medium.com/javascript-in-plain-english/7-javascript-utility-functions-to-improve-your-efficiency-79d27132f186 | |
function bytesToSize (bytes) { | |
if (bytes === 0) return '0 B'; | |
var k = 1024; | |
var sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] | |
var i = Math.floor(Math.log(bytes) / Math.log(k)) | |
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i] | |
} |
View camelize.js
function camelize(str) { | |
const camelizeRE = /-(\w)/g; | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ''); | |
} |
View wowp-batch-image-optimization.sh
# Batch image optimization with Imageoptim from command line as used by WoWPerations team (www.wowperations.com.br | |
mdfind -onlyin . "kMDItemPixelWidth<480 && kMDItemContentType=public.jpg" > imagesLess480JPG.txt | |
mdfind -onlyin . "kMDItemPixelWidth>479 && kMDItemPixelWidth<760 && kMDItemContentType=public.jpg" > imagesLess760JPG.txt | |
mdfind -onlyin . "kMDItemPixelWidth>759 && kMDItemPixelWidth<1024 && kMDItemContentType=public.jpg" > imagesLess1024JPG.txt | |
mdfind -onlyin . "kMDItemPixelWidth>1023 && kMDItemPixelWidth<1280 && kMDItemContentType=public.jpg" > imagesLess1280JPG.txt |
View String.replaceAll.js
/** | |
* String.prototype.replaceAll() polyfill | |
* https://vanillajstoolkit.com/polyfills/stringreplaceall/ | |
* @author Chris Ferdinandi | |
* @license MIT | |
*/ | |
if (!String.prototype.replaceAll) { | |
String.prototype.replaceAll = function(str, newStr){ | |
// If a regex pattern |
View git-track-fetch-pull-all-remote-branches.sh
# Track, fetch and pull all remote branches on a remote GIT repository | |
# Source: https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches/10312587#10312587 | |
git branch -r | grep -v '\->' | while read remote; | |
do git branch --track "${remote#origin/}" "$remote"; | |
done | |
git fetch --all | |
git pull --all |
View 1. Refactoring - Original.js
var isProxyBased = (/S40[\w]{3,5}Browser|Opera\sMini\//i).test(navigator.userAgent); | |
if (('querySelector' in document && 'localStorage' in window && 'addEventListener' in window && !isProxyBased) || (isIE > 6 && document.getElementById('js-holepunched'))) { | |
// do stuff | |
} |
View GoogleHackMasterList.txt
admin account info" filetype:log | |
!Host=*.* intext:enc_UserPassword=* ext:pcf | |
"# -FrontPage-" ext:pwd inurl:(service | authors | administrators | users) "# -FrontPage-" inurl:service.pwd | |
"AutoCreate=TRUE password=*" | |
"http://*:*@www” domainname | |
"index of/" "ws_ftp.ini" "parent directory" | |
"liveice configuration file" ext:cfg -site:sourceforge.net | |
"parent directory" +proftpdpasswd | |
Duclassified" -site:duware.com "DUware All Rights reserved" | |
duclassmate" -site:duware.com |
View wow-tooltip-legacy.0.3.0.js
/*! | |
* WoW Pure CSS Tooltip: an experiment fo pure CSS tooltip on anchor elements. | |
* | |
* This script sets the `aria-label` attribute on all anchors if it's not set or empty. | |
* It uses the contents of the `title` attribute, if present, and remove the title | |
* attribute in order to avoid the browser native tooltip. | |
* Meant to be used with the companion WoW Pure CSS Tooltip styles. | |
* | |
* See: https://gist.github.com/celsobessa/c98e45d2074be5cd915febfed37feeda | |
* (c) 2019 Celso Bessa, MIT License, https://www.celsobessa.com.br |
View .bashrc
# Add this to ~/.bashrc | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="[\u@\h \W]\$(git_branch)\$ " |
NewerOlder