Skip to content

Instantly share code, notes, and snippets.

@0x4a
0x4a / linebreaks.js
Created June 1, 2014 10:34
This javascript code removes all 3 types of line breaks - #js #string
//http://www.textfixer.com/tutorials/javascript-line-breaks.php
someText = someText.replace(/(\r\n|\n|\r)/gm,"");
@0x4a
0x4a / geturlparams.js
Created June 1, 2014 11:27
how to get URL Parameters using #jQuery - #js
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
@0x4a
0x4a / globVar.js
Created June 1, 2014 13:57
list all global variables - #js #dev
console.log(Object.keys(window));
@0x4a
0x4a / log.js
Created June 1, 2014 18:59
simple wrapper for console.log() - #js #dev
//http://htmltweaks.com/Debugging_JavaScript_with_the_Console
var log = function(msg, force) {
force ? alert(msg) : (window.console && window.console.log ? window.console.log(msg) : null);
};
@0x4a
0x4a / RefreshCSS.js
Created June 1, 2014 20:19
#bookmarklet to reload CSS without refreshing the page - #js #css
//http://www.paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/
javascript:(function(){var%20h,a,f;a=document.getElementsByTagName('link');for(h=0;h<a.length;h++){f=a[h];if(f.rel.toLowerCase().match(/stylesheet/)&&f.href){var%20g=f.href.replace(/(&|%5C?)forceReload=\d+/,'');f.href=g+(g.match(/\?/)?'&':'?')+'forceReload='+(new%20Date().valueOf())}}})()
@0x4a
0x4a / elementExist.js
Created June 2, 2014 20:47
check if an element exists - #js
//http://appglobe.com/check-if-element-exists-with-jquery/
jQuery.fn.exists = function() {
return this.length > 0;
};
// usage:
/*
if ( $('#element').exists() ) {
// Do something
@0x4a
0x4a / CapsMute.ahk
Last active August 29, 2015 14:03
turn capslock into mute button - #ahk
; Turn Caps Lock into Mute
CapsLock::Volume_Mute
@0x4a
0x4a / keybase.md
Last active August 29, 2015 14:04
keybase.io/jackel - #md

Keybase proof

I hereby claim:

  • I am 0x4a on github.
  • I am jackel (https://keybase.io/jackel) on keybase.
  • I have a public key whose fingerprint is 6050 97F4 28FA 4F0D CEFD F01F 8EF9 A9B7 5BFB F6DC

To claim this, I am signing this object:

@0x4a
0x4a / 256colors.sh
Created August 9, 2014 01:01
256 terminal colors - #cli #terminal
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@0x4a
0x4a / OO.o-calc_unix-timestamp.txt
Created September 17, 2014 20:29
convert unix timestamp to regular date in Openoffice Calc #OO.o
=<Quellzelle>/86400+DATUMWERT("1970-01-01")