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 simple class for exporting data from a database into a CSV file. | |
If you want to directly output the CSV, simply call | |
CSV::export($field_names, $data, $filename); | |
Where: | |
$field_names is an array, either associative, with the keys of the array being the column headers, or a traditional array, with the values of the array being the column headers of the csv in the order you want them. | |
$data is either an array or object of arrays or objects containing your data in the same order as in the $field_names 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
<?php | |
include("kana.php"); | |
if(isset($_GET['in']) && isset($_GET['action'])) | |
{ | |
$in = $_GET['in']; | |
if($_GET['action'] == "to_hira") | |
{ | |
$out = Kana::to_hiragana($in); |
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> | |
<title>JS Prime Generator</title> | |
</head> | |
<body> | |
<div id="res"></div> | |
<button id="generate">Generate more primes!</button> | |
<script type="text/javascript"> | |
(function(){ |
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> | |
<title>Prime Number Generator</title> | |
</head> | |
<body onload="location.href='#bottom'"> | |
<?php | |
$start = microtime(TRUE); |
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
document.getElementById('sub').addEventListener('click', transliterate, false); | |
function transliterate() | |
{ | |
var input = document.getElementById('in').value; | |
var action = document.getElementById('action').value; | |
var output; | |
switch(action) | |
{ |
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 do_curl($url, $options=array()) | |
{ | |
$cookie = tempnam ("/tmp", "CURLCOOKIE"); | |
$ch = curl_init($url); | |
//Use the user's User Agent and Cookies | |
$opts= array( | |
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'], | |
CURLOPT_COOKIEJAR => $cookie, |
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 Zip($source, $destination) | |
{ | |
if (extension_loaded('zip') === true) | |
{ | |
if (file_exists($source) === true) | |
{ | |
$zip = new ZipArchive(); |
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 | |
define('SAFE', 1); | |
define('EXTREME', 2); | |
define('EXTREME_SAVE_COMMENTS', 4); | |
define('EXTREME_SAVE_PRE', 3); | |
function minify($html, $level=2) | |
{ | |
switch((int)$level) |
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 | |
/** | |
* JSObject | |
* | |
* Class for creating object-literal-like contstructs in PHP | |
*/ | |
class JSObject { | |
/** |
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 | |
/** | |
* Magic constants | |
*/ | |
// Current line number of the php file | |
$current_line_number = __LINE__; | |
// Current PHP file |
OlderNewer