Skip to content

Instantly share code, notes, and snippets.

@jsolid
jsolid / rowexpDT.js
Last active December 12, 2015 10:39
YUI2 DataTable Row Expansion on certain rows
// HTML page
// <h2>Customer Summary</h2>
// <div>
// <button id="esLastHour">Last Hour</button>&nbsp;
// <button id="esDaily">24 Hours</button>&nbsp;
// <button id="esWeekly">1 Week</button>&nbsp;
// <button id="esMonthly">4 Weeks</button>
// </div>
// <div id="errorSummaryDT" class="dataTable"></div>
@jsolid
jsolid / .htaccess
Last active December 14, 2015 21:18
How to cache/refresh static resources (server side)
# Default cache values
ExpiresActive ON
ExpiresByType text/html "access plus 1 minute"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"
ExpiresByType application/x-shockwave-flash "access plus 7 days"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
@jsolid
jsolid / MY_url_helper.php
Last active December 14, 2015 23:29
How to cache/refresh static resources (server and client side)
<?php
/**
* Auto-versioning. Append last modified datetime to filename, .htaccess needs to have the corresponding rule
* Similar function, same name in javascript, common.js
* E.g. "assets/css/style.css" converts to "assets/css/style.1363054031.css"
* @param $url String Relative path
* @return String Modified relative path
*/
if ( ! function_exists('site_ver_url')) {
@jsolid
jsolid / CommonInvoiceQuery.class.php
Last active December 15, 2015 20:09
Add a "Show All" link as search criteria in Invoices module
<?php
public function status($status, $is = true)
{
// $status = 99 to show all result, ignore filtering
if($status !== null && $status != "" && (int)$status < 10)
{
$status = (array) $status;
$statusString = implode(", ", (array) $status);
if($is)