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
myElement.addEventListener("transitionend", function() { | |
alert('transition completed') | |
}, 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
(function(window){ | |
// add ability to save an object | |
if(localStorage){ | |
Storage.prototype.setObj = function (key, obj) { | |
return this.setItem(key, JSON.stringify(obj)); | |
} | |
Storage.prototype.getObj = function(key) { | |
return JSON.parse(this.getItem(key)); |
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
// create an object a and clone it in b | |
var a = { | |
init:function(){return 'hello'} | |
}, b = Object.create(a); | |
// check the values | |
a.init(); // hello | |
b.init(); // hello | |
// set a new return value to init |
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
class Author { | |
private $firstName; | |
private $lastName; | |
public function __construct($firstName, $lastName) { | |
$this->firstName = $firstName; | |
$this->lastName = $lastName; | |
} | |
public function getFirstName() { | |
return $this->firstName; | |
} |
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
//compare two distinct array | |
// check for length and value at each index | |
function equalArrays(a,b) { | |
if (a.length != b.length) return false; | |
for(var i = 0; i < a.length; i++) | |
if (a[i] !== b[i]) return false; | |
return 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
var MyClass = function(options) { | |
/* create a private variable */ | |
privateOpt = options; | |
/* create a public variable*/ | |
this.opt = options; | |
/* to access this variable into the method */ | |
var that = 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
false == false // true | |
0 == false // true | |
-0 == false // true | |
'' == false //true | |
// converting to a Number will return 0 | |
// exemple: |
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
git show --pretty="format:" --name-only HEAD |
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
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.8.3",function($,L){$('form').submit(function () {if($(".jon-submit:checkbox").is(":checked")){return;}var $that = $(this),formWidth = $(this).width(),checkbox = $(document.createElement('input')).prop('type', 'checkbox').addClass('jon-submit').css({'width': 22,'float': 'none','height': 17,margin:0,padding:0,'font-size':12}),checkboxWrapper = $(document.createElement('div')).append(checkbox).append("Submit form").css({'background':'white','width': formWidth,'z-index':2000,'padding':'2px 10px','margin':'2px 0','border-radius':3,'border':'1px solid silver','text-align':'center','box-shadow': '0 0 5p |
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
<style> | |
kbd { | |
padding: 0.1em 0.6em; | |
border: 1px solid #ccc; | |
font-size: 11px; | |
font-family: Arial,Helvetica,sans-serif; | |
background-color: #f7f7f7; | |
color: #333; | |
-moz-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset; | |
-webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset; |