This file contains hidden or 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 em2pxl(){ | |
// how many pixels in 1em | |
var div = $('<div style="width: 1em;"></div>').appendTo('body'); | |
var em = div.width(); | |
div.remove(); | |
// console.log('1em = ' + em + 'pixels.'); | |
return em; | |
} | |
// source: http://forum.jquery.com/topic/how-do-tell-how-many-px-are-in-1em |
This file contains hidden or 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
// Given a query string "?to=email&why=because&first=John&Last=smith" | |
// getUrlVar("to") will return "email" | |
// getUrlVar("last") will return "smith" | |
// Slightly more concise and improved version based on http://www.jquery4u.com/snippets/url-parameters-jquery/ | |
function getUrlVar(key){ | |
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); | |
return result && unescape(result[1]) || ""; | |
} |
This file contains hidden or 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
ErrorDocument 400 /error-docs/400.html | |
ErrorDocument 401 /error-docs/401.html | |
ErrorDocument 403 /error-docs/403.html | |
ErrorDocument 404 /error-docs/404.html | |
ErrorDocument 405 /error-docs/405.html | |
ErrorDocument 500 /error-docs/500.html | |
ErrorDocument 501 /error-docs/501.html | |
ErrorDocument 502 /error-docs/502.html | |
ErrorDocument 503 /error-docs/503.html |
This file contains hidden or 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 | |
// usage: | |
curl_download('http://url'); | |
function curl_download($Url){ | |
// is cURL installed yet? | |
if (!function_exists('curl_init')){ | |
die('Sorry cURL is not installed!'); | |
} | |
This file contains hidden or 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
$(document).ready(function(){ | |
$(window).resize(function(){ | |
var target = '#main'; | |
$(target).css({ | |
position:'absolute', | |
left: ($(window).width() - $(target).outerWidth())/2, | |
top: ($(window).height() - $(target).outerHeight())/2 | |
}); | |
}); |
This file contains hidden or 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(){ | |
$('.checkboxlabel').click(function(){ | |
if($('.checkboxinput').prop('checked')){ | |
$('.checkboxinput').removeAttr('checked'); | |
}else{ | |
$('.checkboxinput').attr('checked', true); | |
} | |
}); | |
}); |
This file contains hidden or 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; |
This file contains hidden or 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 hidden or 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 hidden or 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'},{'_','/','.'} |