Tiny Cross-browser DOM ready function in 111 bytes of JavaScript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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!}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
} |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canvas { | |
margin: 40px; | |
border: 1px solid #999; | |
} |