This file contains 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
for (var i=0, x; x = array[i++];) { } |
This file contains 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
{ | |
show: function(){ | |
$(document).on('keydown',this.keydownListener); | |
}, | |
keydownListener: function(e){ | |
if(e.which===27){ e.originalScope.hide(); } /// <----- originalScope | |
}, | |
hide: function(){ | |
$(document).off('keydown',this.keydownListener); | |
} |
This file contains 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
navigator.q1Vibrate = function(){ | |
var native = navigator.vibrate || navigator.mozVibrate || navigator.wekbitVibrate; | |
if(native){ | |
return native; | |
} | |
var scripts = document.getElementsByTagName('script'); | |
var script = scripts[scripts.length-1]; | |
var path = script.src.replace(/vibrate.js/,''); |
This file contains 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
(function (global) { | |
/* ... Code that defines MyModule ... */ | |
global.MyModule = (global.module || {}).exports = MyModule; | |
})(this); |
This file contains 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
/* Copyright (c) 2016 Tobias Buschor https://goo.gl/gl0mbf | MIT License https://goo.gl/HgajeK */ | |
/* focusin/out event polyfill (firefox) */ | |
!function(){ | |
var w = window, | |
d = w.document; | |
if (w.onfocusin === undefined) { | |
d.addEventListener('focus' ,addPolyfill ,true); | |
d.addEventListener('blur' ,addPolyfill ,true); | |
d.addEventListener('focusin' ,removePolyfill ,true); |
This file contains 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
<?php | |
// Stirct types | |
function test(string $name, int $age, float $cuteness, bool $evil) { | |
//.... | |
} | |
// Convert types | |
function test((string)$name, (int)$age, (float)$cuteness, (bool)$evil) { | |
//.... |
This file contains 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
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<title>WebKit bug workaround: outside click of inline or floated contentEditable-elements focuses the element</title> | |
<script> | |
if (/AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)) { | |
document.addEventListener('DOMContentLoaded', function(){ | |
var fixEl = document.createElement('input'); | |
fixEl.style.cssText = 'width:1px;height:1px;border:none;margin:0;padding:0; position:fixed; top:0; left:0'; | |
fixEl.tabIndex = -1; |
This file contains 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
// ussage: | |
// - include this script | |
// - add the data-c1-ratio-attribute to your images | |
// <img src="big.jpg" data-c1-ratio="1.245" style="width:200px; max-width:100%"> | |
!function(){ | |
'use strict'; | |
var listener = function(e){ | |
this.removeEventListener('load',listener); | |
this.removeEventListener('error',listener); |
This file contains 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
!(function(){ | |
var original = console; | |
Object.defineProperty(window, 'console', { | |
get:function(){ | |
return original; | |
}, | |
set:function(value){ | |
original.log(value) | |
} | |
}) |
This file contains 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
/* Copyright (c) 2016 Tobias Buschor https://goo.gl/gl0mbf | MIT License https://goo.gl/HgajeK */ | |
if (!HTMLFormElement.prototype.reportValidity) { | |
HTMLFormElement.prototype.reportValidity = function() { | |
if (this.checkValidity()) return true; | |
var btn = document.createElement('button'); | |
this.appendChild(btn); | |
btn.click(); | |
this.removeChild(btn); | |
return false; |
OlderNewer