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
// Bad practice! | |
function detectMobile() { | |
return (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.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
<?php | |
# This grabs the keyword off the url -- index.php?keyword=Clouds | |
$keyword = $_GET['keyword']; | |
# Only do this if we've already passed in a keyword (i.e. it's not blank) | |
if($keyword != "") { | |
# Load the data from Google via cURL | |
$curl_handle = curl_init(); | |
curl_setopt($curl_handle,CURLOPT_URL,"http://ajax.googleapis.com/ajax/services/search/images?v=1.0&imgsz=xlarge&q=".urlencode($keyword)); |
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
validate: function () { | |
var form = this.$el.is("form") ? this.$el : this.$el.closest("form"); | |
if (!form.is("form")) { | |
form = this.$el.find("form"); | |
} | |
return form.data().unobtrusiveValidation.validate(); | |
} |
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
if(preg_match('/localhost/', $_SERVER['HTTP_HOST'])){ | |
//DATOS OFFLINE | |
$dbname = ""; | |
$ipserver = "localhost"; | |
$usuariobase = "root"; | |
$passbase = "root"; | |
} else { | |
//DATOS ONLINE | |
$dbname = ""; | |
$ipserver = "localhost"; |
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 | |
// MySQL Database interface class | |
class DB { | |
private $sql; | |
private $mysql; | |
private $result; | |
private $db; | |
public $serialize_bool = true; // Arrays are serialized automatically, booleans too? |
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
require('db.php'); | |
//$db->select($table,$where=array(),$limit=false,$order=false,$where_mode="AND",$print_query=false) | |
//$db->update($table, $fields=array(), $where=array()) | |
//$db->insert($table, $fields=array()) | |
$db = new db($database_name, $username, $password, $host); // $host is optional and defaults to 'localhost' |
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
Verifying I am +craiem on my passcard. https://onename.com/craiem |