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) { | |
"use strict"; | |
/** | |
* Helpers | |
*/ | |
var document = window.document, | |
WebSocket = window.WebSocket, | |
Worker = window.Worker, | |
localStorage = window.localStorage, |
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
// Based on: http://lea.verou.me/2009/02/find-the-vendor-prefix-of-the-current-browser/ | |
var VENDOR_PREFIX = (function () { | |
var regex = /^(Webkit|Khtml|Moz|ms|O)(?=[A-Z])/, | |
styleDeclaration = document.getElementsByTagName("script")[0].style; | |
for (var prop in styleDeclaration) { | |
if (regex.test(prop)) { | |
return prop.match(regex)[0].toLowerCase(); |
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 friendly(str) { | |
"use strict"; | |
// Turn string into lower cases | |
str = str.toLowerCase(); | |
// Normalize vocals | |
str = str.replace(/\á|\à|\ä|\â|\ã|\ª/g, "a"); | |
str = str.replace(/\é|\è|\ë|\ê/g, "e"); | |
str = str.replace(/\í|\ì|\ï|\î/g, "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
<?php | |
class Database { | |
private $HOST = "...Your hostname or IP here..."; | |
private $USER = "...Username to log into database..."; | |
private $PASS = "...Password to log into database..."; | |
private $DDBB = "...Name of database..."; | |
private function connect() { | |
$c = mysql_connect($this->HOST, $this->USER, $this->PASS); |
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 context = (function () { | |
"use strict"; | |
// Get the HTML Canvas element | |
var canvas = document.querySelector("canvas"); | |
// Set canvas size | |
canvas.width = 200; | |
canvas.height = 200; |
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 bind(listener, events, callback, useCapture) { | |
events.split(" ").forEach(function (ev) { | |
listener.addEventListener(ev, callback, useCapture); | |
}); | |
} | |
// Example: | |
// bind(document, "mousedown mouseup keydown keyup", proccess); |
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 fps = 1000 / 60, | |
rAF = window.requestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
function (callback) { | |
window.setTimeout(callback, fps); | |
}; |
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
!!! 5 | |
//if lt IE 7 | |
html.no-js.lt-ie10.lt-ie9.lt-ie8.lt-ie7.ie6(lang="en") | |
//if IE 7 | |
html.no-js.lt-ie10.lt-ie9.lt-ie8.ie7(lang="en") | |
//if IE 8 | |
html.no-js.lt-ie10.lt-ie9.ie8(lang="en") | |
//if IE 9 | |
html.no-js.lt-ie10.ie9(lang="en") | |
//[if gt IE 9] <! |
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
// Defining the custom event | |
var customEvent = (function () { | |
"use strict"; | |
// Create a generic event | |
var e = document.createEvent("Event"); | |
// Define the custom event name | |
e.initEvent("custom", true, true); | |
// Grab event to trigger | |
return e; | |
}()); |
OlderNewer