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
/* -- set a non-existent error handler + view renderer -- */ | |
$controller->returnResponse(true); | |
$controller->setParam('useDefaultControllerAlways', true); | |
$controller->setParam('noErrorHandler', true); | |
$controller->setParam('noViewRenderer', true); | |
$response = $controller->dispatch(); |
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
#!/usr/bin/perl | |
use DBI; | |
$dbi_host="localhost"; | |
# all databases | |
@dbi_u=("admin_user"); | |
@dbi_p=("qwerty"); | |
#set the max count value |
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
public function combobox($name, $values_array, $default=null, $size=300, $required=false){ | |
$req_bxml = ($required)? " b:required=\"true\"" : ""; | |
$bxml = '<b:combobox b:width="'. $size .'px" b:name="'. $name .'" b:text="'. $default .'"'. $req_bxml .'>'; | |
foreach ($values_array as $value) { | |
$bxml .= '<b:combo-option b:value="'. $value['value'] .'">'. $value['name'] .'</b:combo-option>'; | |
} | |
$bxml .= '</b:combobox>'; | |
return $bxml; | |
} |
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 mysql_timestamp_to_human($dt){ | |
$yr=strval(substr($dt,0,4)); | |
$mo=strval(substr($dt,4,2)); | |
$da=strval(substr($dt,6,2)); | |
$hr=strval(substr($dt,8,2)); | |
$mi=strval(substr($dt,10,2)); | |
//$se=strval(substr($dt,12,2)); | |
return date("m/d/Y H:i", mktime ($hr,$mi,0,$mo,$da,$yr))." GMT"; | |
} |
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 ($_POST['q']){ | |
$dirty_html = $_POST['q']; | |
if (!$dirty_html) { | |
echo ('You must write some HTML!'); | |
} else { | |
$config = HTMLPurifier_Config::createDefault(); | |
$config->set('Core', 'Encoding', 'ISO-8859-1'); | |
$config->set('HTML', 'Doctype', 'XHTML 1.0 Transitional'); | |
$config->set('HTML', 'TidyLevel', 'heavy'); |
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 | |
$mysql_host = "localhost"; | |
$mysql_user = ""; | |
$mysql_password = ""; | |
$mysql_db = ""; | |
$user = "admin"; | |
$pass = "qwerty"; | |
$pass_enc = md5($pass); |
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
ls -1 | while read file | |
do | |
target=$(echo $file | sed -e "s/\&/_/") | |
mv "$file" "$target" | |
done |
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 | |
// Find and replace facility for complete MySQL database | |
// | |
// Originally written by Mark Jackson @ MJDIGITAL | |
// Can be used by anyone - but give me a nod if you do! | |
// http://www.mjdigital.co.uk/blog | |
// http://www.mjdigital.co.uk/blog/search-and-replace-text-in-whole-mysql-database/ | |
// | |
// PKDAVIES: | |
// Changed REGEX to LIKE |
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
#!/bin/bash | |
for file in `ls ./*.txt` | |
do | |
cat $file >> all.files | |
done |
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
<pre> | |
<?php | |
$row = 0; | |
if (($handle = fopen("data.csv", "r")) !== FALSE) { | |
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { | |
$num = count($data); | |
$model_id = $data[1]; | |
for ($c=2; $c < $num; $c++) { | |
if (!empty($data[$c])){ |
OlderNewer