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
test |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 remove_url_key($key){ | |
$base_uri = $_SERVER['QUERY_STRING']; | |
$_new_uri = array(); | |
if(!isset($_GET[$key])) | |
{ | |
$q_string = $base_uri; | |
}else | |
{ | |
foreach($_GET as $uri=>$val) | |
{ |
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
// version 1: | |
// param: $birth_date (input string: YYYY-MM-DD) | |
function birthday ($birth_date){ | |
list($year,$month,$day) = explode("-",$birth_date); | |
$today = date('d-m-Y'); | |
$a_birthday = explode('-', $birthday); | |
$a_today = explode('-', $today); | |
$age = $a_today[2] - $year; | |
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
//HTML | |
<select id="year_selector" onchange="redirectTo(this)"> | |
<option value="">Select Year</option> | |
<option value="2014">2014</option><option value="2013">2013</option> | |
</select> | |
//Javascript |
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 getParameterByName(name) { | |
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); | |
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | |
results = regex.exec(location.search); | |
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | |
} |
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 updateQueryStringParameter(uri, key, value) { | |
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i"); | |
separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { | |
return uri.replace(re, '$1' + key + "=" + value + '$2'); | |
} | |
else { | |
return uri + separator + key + "=" + 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
1. click html header -> generate new url with query string including new orderby field name | |
2. php parse query string, handle filed name | |
//html | |
<tr><td align="left" width="10%" class="table_toprow"><div class="orderby" id="job_serial_number"><b>Serial Number</b></div></td> | |
<td align="left" width="10%" class="table_toprow"><div id="invoice_status"><b>Invoice Status</b></div></td> | |
<td align="left" width="20%" class="table_toprow"><div class="orderby" id="job_name"><b>Name</b></div></td> | |
<td align="left" width="10%" class="table_toprow"><div class="orderby" id="job_brand"><b>Brand</b></div></td> |
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
header("Pragma: public"); | |
header("Expires: 0"); | |
header("Pragma: no-cache"); | |
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); | |
header("Content-Type: application/force-download"); | |
header("Content-Type: application/octet-stream"); | |
header("Content-Type: application/download"); | |
header('Content-disposition: attachment; filename=' . '1006_3d-HK-Flag.png'); | |
header("Content-Transfer-Encoding: binary"); | |
header('Content-Length: ' . filesize(WWW_ROOT.'/feedback_files/1006_3d-HK-Flag.png')); |
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
//excel layout | |
<?php | |
header ("Expires: Mon, 28 Oct 2008 05:00:00 GMT"); | |
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT"); | |
header ("Cache-Control: no-cache, must-revalidate"); | |
header ("Pragma: no-cache"); | |
header ("Content-type: application/vnd.ms-excel"); | |
header ("Content-Disposition: attachment; filename=\"report_".date('dmy_His').".xls" ); | |
header ("Content-Description: Generated Report" ); | |
?> |
OlderNewer