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 | |
require_once('./caterpillar.php'); | |
// set configuration params | |
$config = array( | |
'crawlUrl' => 'http://www.url-to-crawl.co', | |
'dbUser' => 'username', | |
'dbPass' => 'password', | |
'dbName' => 'database', | |
'dbHost' => '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
(function($) { | |
if ( !$.cssHooks ) { | |
throw("jQuery 1.4.3+ is needed for this plugin to work"); | |
return; | |
} | |
function styleSupport( prop ) { | |
var vendorProp, supportedProp, | |
capProp = prop.charAt(0).toUpperCase() + prop.slice(1), | |
prefixes = [ "Moz", "Webkit", "O", "ms" ], |
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 | |
/** | |
* Copyright (C) <2012> <Corey Ballou> | |
* @author Corey Ballou <http://www.craftblue.com> | |
* @license MIT License | |
*/ | |
/** | |
* Handles FTP download of a remote file and stores it in a local file. | |
* |
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 Komodo IDE / Edit macro for tidying up files. New addition for CSS. | |
* | |
* @author Corey Ballou http://coreyballou.com <only added CSS modification> | |
* | |
* Credit to the original unknown author of this macro: | |
* http://community.activestate.com/forum/format-document-script | |
*/ | |
komodo.assertMacroVersion(3); | |
if (komodo.view.scintilla) { |
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 | |
/** | |
* The below code will calculate the metaphone value for every word in the MySQL dictionary we | |
* just created and update the table accordingly. This code is nothing fancy, but gets the | |
* job done. Sorry I didn't use PDO :) | |
*/ | |
// specify your MySQL connection settings | |
define('HOST', 'localhost'); | |
define('USERNAME', 'your_username'); |
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 | |
// client side: assume user has maliciously used the following values in a form search input field and submitted | |
$field = '<input type="text" name="query" value="%slow_your_db" />'; | |
// server-side: assume retrieval of form search input value | |
$search_term = !empty($_GET['query']) ? $_GET['query'] : NULL; | |
// try to escape the input before querying, but we fail to escape the qualifier | |
// and it remains "%slow_your_db" | |
$search_term = mysql_real_escape_string($search_term); |
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 clean($value, $escape = true, $quotes = true) | |
{ | |
$a = 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
// assumes you have a parent container with relative positioning | |
$('a.my_tooltip').tooltip({ | |
effect: 'fade', | |
relative: true, | |
predelay: 300, | |
onBeforeShow: function() { | |
var | |
config = this.getConf(), | |
$tip = this.getTip(); | |
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 | |
/** | |
* The code below shows example usage of the SecureHash class for | |
* encrypting a password. In terms of additional usage, you should | |
* store the resulting encrypted password in addition to the salt | |
* in your db. | |
*/ | |
// load the class | |
$secure = new SecureHash(); |
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 following div will remain at 100% width even with padding applied */ | |
div.padded { | |
width: 100%; | |
padding: 20px; | |
} |