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 hashtable = (function() { | |
var hashCode = function(value) { | |
var hash = 0, | |
i, chr, len; | |
value = value.toString(); | |
if (value.length === 0) { | |
return hash; | |
} |
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
// METHODE 1 | |
Array.prototype.slice.call([array]) | |
/* | |
* Example | |
var arr = [37, 1, 2, 3], | |
arr2 = Array.prototype.slice.call(arr); | |
console.log(arr === arr2); // false => not equal |
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
// http://stackoverflow.com/questions/2388030/accessing-functions-bound-to-event-handlers-with-jquery | |
// obj is an jQuery object, e.g. | |
var obj = $('body'); | |
// jQuery < 1.8 | |
obj.data('events'); | |
// jQuery >= 1.8 | |
$._data(obj[0], "events") |
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
.vertical-align-class { | |
position: absolute; | |
top: 50%; | |
transform: translateY(-50%); | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Blob to File (from DataURL-String)</title> | |
<script> | |
window.onload = function () { | |
var file, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>DataURL to Blob to File (from DataURL-String)</title> | |
<script> | |
window.onload = function () { | |
var dataURL = 'data:image/gif;base64,R0lGODlhGAAYAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGx4eHh8fHyAgICEhISIiIiMjIyQkJCYmJicnJygoKCkpKSsrKywsLC4uLi8vLzAwMDIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD4+Pj8/P0BAQEREREVFRUZGRkhISElJSUpKSktLS01NTVBQUFJSUlRUVFZWVlhYWFlZWVtbW19fX2BgYGJiYmNjY2VlZWdnZ2lpaWtra2xsbG5ubnFxcXh4eHp6eoeHh4iIiImJiYyMjI6Ojo+Pj5CQkJGRkZKSkpOTk5SUlJeXl5ubm5ycnJ6enp+fn6CgoKKioqWlpampqa2trbm5ub+/v8DAwMbGxsvLy8/Pz9TU1Nzc3OHh4ebm5szMzBISEh0dHSUlJSoqKi0tLUJCQkdHR1NTU1dXV1paWl1dXV5eXmRkZGpqanl5eXt7e319fYCAgIGBgYODg4aGhoqKiouLi42NjZ2dnaGhoaurq66urq+vr7GxsbS0tLq6ur29vefn5/Dw8PX19fr6+jExMT09PUNDQ21tbW9vb3BwcHJycnV1dXZ2dnd3d6ampqioqKysrLa2tr6+vtHR0ejo6O/v71FRUWhoaLu7u83NzdXV1RwcHIWFhbCwsLW1tbi4uE9PT5qamuXl5QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
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 testAsyncDeferred = function() { | |
// create Deferred object | |
var deferredObject = $.Deferred(); | |
setTimeout(function() { | |
var date = new Date().getTime(); | |
if (date % 2 === 0) { | |
// resolve deferred => .done is executed |
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
.flexbox-vertical { | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: center; | |
} | |
/* prefixed */ | |
/* | |
.flexbox-vertical { |
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
// Promise - using then method to resolve promise and catch method to reject it | |
var promise = new Promise(function(resolve, reject) { | |
window.setTimeout(function() { | |
var now = new Date().getTime(); | |
(now % 2) ? resolve("ungerade - " + now) : reject("gerade - " + now); | |
}, 1000); | |
}); | |
promise |
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() { | |
// extend object prototype | |
if (Object.extend === undefined) { | |
Object.prototype.extend = function(obj) { | |
var _key; | |
for (_key in obj) { | |
if (obj.hasOwnProperty(_key)) { | |
this[_key] = obj[_key]; | |
} |
OlderNewer