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 () { | |
'use strict'; | |
// change "moduleName" to the name of the module you are making | |
var moduleName = {}; | |
// do something | |
if (typeof module !== 'undefined' && module.exports) { | |
module.exports = moduleName; | |
} else { |
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
// from: http://stackoverflow.com/a/3969760/649239 | |
function Timer(callback, delay) { | |
var timerId, start, remaining = delay; | |
this.pause = function() { | |
window.clearTimeout(timerId); | |
remaining -= new Date() - start; | |
}; |
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 a = '5'; | |
var b = new String('5'); | |
console.log( typeof a, typeof b, a == b, a === b ); | |
/* Output: | |
> string | |
> object | |
> 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
<a href="http://stackoverflow.com/questions/7794301/window-onunload-is-not-working-properly-in-chrome-browser-can-any-one-help-me/9325742#9325742">Leave this page!</a> |
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 entry{ | |
private $id = -1; // required | |
private $title = ""; // required | |
private $author = -1; // required, author ID | |
private $excerpt = ""; // either turn title into excerpt or manually enter one | |
private $date = ""; // required | |
// #TODO | |
// post type interface? |
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 creation | |
function Vehicle(p) { | |
this.brand = p.brand || ""; | |
this.model = p.model || ""; | |
this.wheels = p.wheels || 0; | |
} | |
// Main class' methods | |
Vehicle.prototype.getBrand = function () { | |
return this.brand; |
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 | |
if(!empty($_REQUEST)){ | |
// get real parameters | |
$parameters = $_REQUEST; | |
} | |
if(isset($_SERVER['PATH_INFO'])){ | |
// path = the trimmed PATH_INFO string | |
// allowed characters: | |
// {'a','b',..,'z'},{'A','B',...,'Z'},{'0','1',...,'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
// source: http://stackoverflow.com/a/9251169/649239 | |
var escape = document.createElement('textarea'); | |
function escapeHTML(html) { | |
escape.innerHTML = html; | |
return escape.innerHTML; | |
} | |
function unescapeHTML(html) { |
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 params = {}; | |
var queryString = location.search.substring(1); // For # params use location.hash | |
var regex = /([^&=]+)=([^&]*)/g; | |
var m; | |
while (m = regex.exec(queryString)) { | |
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); | |
} |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>simple Responsive viewer by Adonis K.</title> | |
<link href="//cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css"></link> | |
<style> | |
iframe { | |
transition: 150ms ease; | |
display: block; | |
margin: 0 auto; |