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
$(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
<?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
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
// 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
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
javascript:void((function(){var%20d=document;d.write('<!DOCTYPE%20html><html><head><meta%20charset="UTF-8"><title>'+d.title+'%20-%20Responsive%20test</title><link%20rel="stylesheet"%20href="http://responsive.victorcoulon.fr/assets/css/app.css"><script%20src="http://responsive.victorcoulon.fr/assets/js/app.min.js"></script></head><body><header><div%20class="close"><a%20href="#">%C3%97</a></div><div%20id="size"></div><div%20id="devices"><a%20href="#"%20class="tablet-portrait"><span>Tablet%20Portrait</span></a><a%20href="#"%20class="tablet-landscape"><span>Tablet%20Landscape</span></a><a%20href="#"%20class="smartphone-landscape"><span>iPhone%20Landscape</span></a><a%20href="#"%20class="smartphone-portrait"><span>iPhone%20Portrait</span></a><a%20href="#"%20class="auto%20active"><span>Auto</span></a></div></header><section><iframe%20id="wrapper"%20src="'+d.URL+'"%20onLoad="resbook.changeUrl(this.contentWindow.location,this.contentDocument.title);"></iframe></section></body></html>')})()); | |
<!-- http://responsive.v |
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 | |
// inside included file | |
defined('INCLUDE') or die('No direct access allowed.'); | |
?> | |
<?php | |
// inside includer | |
define('INCLUDE', 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
<?php | |
// db info | |
$db_host = 'localhost'; // local only connection | |
$db_port = 3306; // default mysql port | |
$db_database = 'db_user'; // database username | |
// initiate dns string | |
$dns = "mysql:host=$db_host;port=$db_port;dbname=$db_database"; | |
// create database object or close connection |
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(isset($_POST['submit'])){ | |
echo $_POST['text'] . ' got submitted.'; | |
}else{ | |
?> | |
<form action="self_exec.php"> | |
<fieldset> | |
<input type="text" name="text" value="text" placeholder="Type here..."> | |
<input type="submit" name="submit" value="Submit"> | |
</fieldset> |