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
/** | |
* Creates a Javascript Object with gender and date of birth | |
* - extracted from a given valid Sri Lanka N.I.C. Number | |
* [email protected] | |
*/ | |
function parseNIC(nic) { | |
var nicdata = { | |
gender: '', | |
dob: '' | |
}; |
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
<style> | |
body { | |
background: white; | |
font-size: 13px; | |
overflow: hidden; | |
} | |
#notifcation_overlay { | |
position: absolute; | |
left: 0px; | |
top: 0px; |
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
org.gradle.daemon=true | |
org.gradle.parallel=true |
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
private void PrintReportToPrinter(JasperPrint jp) throws Exception { | |
PrintService[] lps = PrintServiceLookup.lookupPrintServices(null, null); | |
PrintService srv = (PrintService) JOptionPane.showInputDialog(this, "Select printer", "Printer", JOptionPane.PLAIN_MESSAGE, null, lps, lps[0]); | |
PrinterJob printerJob = PrinterJob.getPrinterJob(); | |
printerJob.setPrintService(srv); | |
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); | |
printRequestAttributeSet.add(new Copies(1)); | |
JRPrintServiceExporter exporter = new JRPrintServiceExporter(); |
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 slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
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
if (defined('DEVELOPMENT') && DEVELOPMENT === true) | |
{ | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
} |
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 | |
function base_url() { | |
$isSecure = false; | |
if (isset($_SERVER['HTTPS'])) { | |
$isSecure = $_SERVER['HTTPS'] == 'on'; | |
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { | |
$isSecure = true; | |
} | |
$REQUEST_PROTOCOL = $isSecure ? 'https' : 'http'; |
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 | |
function p($key, $num = FALSE) | |
{ | |
$var = filter_input(INPUT_POST, $key); | |
if ($var) { | |
if (is_array($var)) { | |
return $var; | |
} | |
if (!is_numeric($var) && $num && empty($var)) { | |
return intval(0); |
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 | |
function reloadUrlWithParams($anchor = false, $params = false) | |
{ | |
$temparr = array(); | |
if ($params && is_array($params)) { | |
foreach ($params as $k => $v) { | |
$temparr[] = urlencode($k) . "=" . urlencode($v); | |
} | |
} |
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 | |
function setFlashDataItem($key, $value) | |
{ | |
if (!array_key_exists('flashdata', $_SESSION)) { | |
$_SESSION["flashdata"] = array(); | |
} | |
$_SESSION["flashdata"][$key] = $value; | |
} |
OlderNewer