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 | |
function connect_mysql() { | |
$mysql_hostname = "localhost"; | |
$mysql_user = "x"; | |
$mysql_password = "x"; | |
$mysql_database = "x"; | |
$dbh = new PDO("mysql:host=$mysql_hostname;dbname=$mysql_database", $mysql_user, $mysql_password, | |
array( |
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
.slider { | |
/* set initial width */ | |
width: 520px; | |
/* hide the content that overflows (to allow second box to show through) */ | |
overflow: hidden; | |
display: inline-block; | |
/* skew container so that it has angled edge, and set up transition */ | |
transform: skewX(-20deg); |
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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
body { | |
background: #f06; | |
background: linear-gradient(31deg, #58f, #59f, #08d); | |
min-height: 100%; | |
height:10px; | |
font-size:100%; | |
} |
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 http-equiv="content-type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="user-scalable=no,initial-scale=1.0,maximum-scale=1.0,width=device-width,minimal-ui"> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge"> | |
<title> Media-Query Responsive Image Demo </title> | |
<meta name="keywords" content=""> |
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 Struct | |
{ | |
/** | |
* Define a new struct object, a blueprint object with only empty properties. | |
*/ | |
public static function factory() | |
{ | |
$struct = new self; | |
foreach (func_get_args() as $value) { |
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
<!-- Assume a file is uploaded with this HTML form --> | |
<form method="POST" enctype="multipart/form-data"> | |
<input type="file" name="foo" value=""/> | |
<input type="submit" value="Upload File"/> | |
</form> | |
<!-- When the HTML form is submitted, the server-side PHP code can validate and upload the file like this: --> |
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
/** | |
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off. | |
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request | |
*/ | |
function getCookie(name) | |
{ | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); |
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 f = document.getElementById('foo'); | |
document.addEventListener('click', function(ev){ | |
f.style.left = (ev.clientX-25)+'px'; | |
f.style.top = (ev.client-25)+'px'; | |
},false); |
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
<p>Click anywhere to move the ball</p> | |
<div id="foo"></div> |