Skip to content

Instantly share code, notes, and snippets.

View thegitfather's full-sized avatar

thegitfather thegitfather

View GitHub Profile
@thegitfather
thegitfather / jQuery.wrapRegExp.js
Last active July 13, 2021 15:50
wrap a new element around some RegExp
(function($) {
'use strict';
$.fn.wrapRegExp = function(options) {
// defaults
var settings = $.extend({
regExp: /([\s\S]*)/,
wrapper: '<div style="border:1px solid red;" />'
}, options);
@thegitfather
thegitfather / favicon.html
Created January 30, 2016 11:55
favicon_yinyang.ico (inline, base64)
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABQMAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAREQAAAAAAEREREQAAAAEiIREREAAAEiIiERERAAASESIhEREAASIRIiERERABIiIiEREREAEiIiEREREQASIiIRIhERAAEiIhEiERAAASIiEREREAAAEiIhEREAAAABEiIREAAAAAABERAAAAAAAAAAAAAAD//wAA/D8AAPAPAADgBwAAwAMAAMADAACAAQAAgAEAAIABAACAAQAAwAMAAMADAADgBwAA8A8AAPw/AAD//wAA" rel="icon" type="image/x-icon">
@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 / jquery.randomize.js
Created January 20, 2016 23:12
randomize dom elements
/* Usage:
$('button').click(function() {
$("div.band").randomize("div.member");
});
*/
(function($) {
@thegitfather
thegitfather / examples.md
Last active July 16, 2017 00:28
markdown elements

An exhibit of Markdown

This note demonstrates some of what [Markdown][1] is capable of doing.

Note: Feel free to play with this page. Unlike regular notes, this doesn't automatically save itself.

Basic formatting

Paragraphs can be written like so. A paragraph is the basic block of Markdown. A paragraph is what text will turn into when there is no reason it should become anything else.

@thegitfather
thegitfather / load_replace_css_js.user.js
Last active July 13, 2021 15:52
load/replace css/js
// ==UserScript==
// @name load_replace_css_js
// @namespace https://gist.github.com/search?q=thegitfather+UserScript
// @author thegitfather
// @version 0.11
// @description load/replace css/js
// @updateURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js
// @downloadURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js
// @include http://127.0.0.1/*
// @grant none
@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 / visual-event-2_bookmarklet.js
Last active December 29, 2023 15:46
Visual Event is an open source Javascript bookmarklet which provides debugging information about events that have been attached to DOM elements. Visual Event shows: Which elements have events attached to them. The type of events attached to an element. The code that will be run with the event is triggered. The source file and line number for whe…
javascript:(function()%20{var%20protocol%20=%20window.location.protocol%20===%20'file:'%20?'http:'%20:%20'';var%20url%20=%20protocol+'//www.sprymedia.co.uk/VisualEvent/VisualEvent_Loader.js';if(%20typeof%20VisualEvent!='undefined'%20)%20{if%20(%20VisualEvent.instance%20!==%20null%20)%20{VisualEvent.close();}else%20{new%20VisualEvent();}}else%20{var%20n=document.createElement('script');n.setAttribute('language','JavaScript');n.setAttribute('src',url+'?rand='+new%20Date().getTime());document.body.appendChild(n);}})();
@thegitfather
thegitfather / zzz_ascii
Last active July 13, 2021 15:54
zzz_ascii
__________________
/\ ______________ \
/::\ \ZZZZZZZZZZZZ/\ \
/:/\.\ \ /:/\:\ \
/:/Z/\:\ \ /:/Z/\:\ \
/:/Z/__\:\ \____/:/Z/ \:\ \
/:/Z/____\:\ \___\/Z/ \:\ \
\:\ \ZZZZZ\:\ \ZZ/\ \ \:\ \
\:\ \ \:\ \ \:\ \ \:\ \
\:\ \ \:\ \_\;\_\_____\;\ \
@thegitfather
thegitfather / reset.css
Last active May 12, 2016 15:46
reset.scss
html, body, body div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, figure, footer, header, menu, nav, section, time, mark, audio, video, details, summary {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-weight: normal;
vertical-align: baseline;
background: transparent;
}