Skip to content

Instantly share code, notes, and snippets.

View herschel666's full-sized avatar
:octocat:
const [status, setStatus] = useGitHub();

Emanuel Kluge herschel666

:octocat:
const [status, setStatus] = useGitHub();
View GitHub Profile
@herschel666
herschel666 / machine.js
Last active December 21, 2020 14:30
Generated by XState Viz: https://xstate.js.org/viz
const LOGGED_IN = 'LOGGED_IN';
const LOGGED_OUT = 'LOGGED_OUT';
const SOFT_LOGGED_IN = 'SOFT_LOGGED_IN';
const res = { locals: {} };
const fetchMachine = Machine(
{
id: 'authentication',
initial: 'idle',
@herschel666
herschel666 / README.md
Created February 17, 2016 08:55 — forked from dciccale/README.md
Tiny Cross-browser DOM ready function in 111 bytes of JavaScript

DOM Ready

Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.

@herschel666
herschel666 / gist:5676355
Last active December 17, 2015 21:39
Multi-Line-String-Wrapper
/*
* Wrapper for the Multi-Line-String-approach demonstrated here:
* http://tomasz.janczuk.org/2013/05/multi-line-strings-in-javascript-and.html
*
* multiline(function () {/*
* <body>
* <h1>Hodor!</h1>
* <p>Lorem ipsum dolor sit amet.</p>
* </body>
* */ /* <- needed to keep this as a comment!});
@herschel666
herschel666 / svg-fallback.js
Created February 24, 2013 14:48
PNG-Fallback for SVG-Images. Inspired by http://codepad.co/s/02aac9, but realized without jQuery-Dependency. Only Modernizr is needed.
var rSvg = /\.(svg)$/;
if ( !Modernizr.svg ) {
for ( var i = 0, img; img = document.images[i]; i +=1 ) {
if ( !rSvg.test(img.src) ) continue;
img.src = img.src.replace(rSvg, '.png');
}
}
@herschel666
herschel666 / gist:3933574
Created October 22, 2012 19:35
Frage an Radio Eriwan …

Frage an Radio Eriwan: Stimmt es, dass der große Kosmonaut Juri Gagarin in Moskau einen Mercedes-Benz gewonnen hat?

Antwort von Radio Eriwan: Im Prinzip ja. Jedoch war es nicht der Kosmonaut Juri Gagarin, sondern ein Tischler. Und er hieß auch nicht Juri Gagarin, sondern Boris Iwankowitsch. Überdies war es nicht in Moskau, sondern in St. Petersburg, und es war kein Mercedes, sondern ein Fahrrad. Außerdem hat er es nicht gewonnen, sondern es ist ihm gestohlen worden.

@herschel666
herschel666 / annoying-mobile-device-users.js
Created September 17, 2012 07:13
How to annoy Mobile-Device-Users
/*
* Hiding the address bar after scrolling to the top.
* For the troll in you.
**/
!'ontouchstart' in document.documentElement || window.addEventListener('scroll', function () {
if ( window.scrollY ) return;
window.scrollTo(0, 1);
canvas {
margin: 40px;
border: 1px solid #999;
}​