Skip to content

Instantly share code, notes, and snippets.

Avatar
😊
It's working ....

Sampath Thennakoon sampathsl

😊
It's working ....
View GitHub Profile
@sampathsl
sampathsl / index1.js
Created Dec 13, 2015
ES6 - var vs let keywords
View index1.js
var checkDataVar = 'Test';
console.log('Outside var showES5Features: ' + checkDataVar);
while(true){
//var key word
var checkDataVar = 'Poop!';
console.log('Inside var showES5Features: ' + checkDataVar);
break;
}
@sampathsl
sampathsl / bs3-login-form.html
Created Jul 24, 2016 — forked from bMinaise/bs3-login-form.html
Bootstrap 3 - Login Form Example From: http://bootsnipp.com
View bs3-login-form.html
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1>
<div class="account-wall">
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120"
alt="">
<form class="form-signin">
<input type="text" class="form-control" placeholder="Email" required autofocus>
<input type="password" class="form-control" placeholder="Password" required>
@sampathsl
sampathsl / context.xml.default
Created Oct 15, 2016
sample liferay tomcat context.xml.default file
View context.xml.default
<Resource name="LiferayPool" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="any_user" password=" any_pass" driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@192.168.1.180:1521:orcl"/>
@sampathsl
sampathsl / portlet-ext.properties
Created Oct 15, 2016
sample Liferay CMS portlet-ext.properties file
View portlet-ext.properties
#The purpose of theme.css.fast.load property is to tell whether css should be cached or not. If it is cached, it can be loaded faster.
theme.css.fast.load=false
theme.images.fast.load=false
javascript.fast.load=true
javascript.log.enabled=false
layout.template.cache.enabled=false
velocity.engine.resource.manager.cache.enabled=false
com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.themepreview.ThemePreviewFilter=true
com.liferay.portal.servlet.filters.sso.cas.CASFilter=false
@sampathsl
sampathsl / check-date.js
Created Oct 18, 2016
Validate the user entered date using JavaScript - buggy (UTC) - Gives invalid date for 01/01/1970
View check-date.js
function checkDate(str)
{
var matches = str.match(/(\d{1,2})[\/](\d{1,2})[\/](\d{4})/);
if (!matches) return;
var day = parseInt(matches[1],10);
var month = parseInt(matches[2],10);
var year = parseInt(matches[3],10);
var date = new Date(year, month - 1, day);
if (!date || !date.getTime()) return;
if (date.getMonth() + 1 != month ||
@sampathsl
sampathsl / check-date.js
Last active Oct 18, 2016
Validate the user entered date using JavaScript
View check-date.js
/*
* Validate the user entered date
* '01/01/1970' -> valid date
* '45/01/1970' -> invalid date
*/
function checkDate(str)
{
var date = null;
var matches = str.match(/(\d{1,2})[\/](\d{1,2})[\/](\d{4})/);
@sampathsl
sampathsl / numeric-input.js
Last active Oct 21, 2016
How to restrict an input field to a numeric input field using JavaScript
View numeric-input.js
/*
* Avoid the A-Z a-z and special characters in text boxes
*/
jQuery(document).on('keypress', 'input.numeric', function(e) {
/* avoid entering multiple '.' */
if (e.currentTarget.value)
{
var keyCode = e.which ? e.which : e.keyCode;
var c = String.fromCharCode(keyCode);
@sampathsl
sampathsl / currency.html
Created Oct 21, 2016
How to restrict an input field to a numeric input field using JavaScript - implement the HTML input box
View currency.html
<input id="txtCurrency" name="txtCurrency" placeholder="" maxlength="10" class="numeric form-textbox" pattern="^(?:\d*\.\d{1,2}|\d+)" title="Value should be numeric with maximum two decimal points"/>
@sampathsl
sampathsl / disable-drop-paste.js
Created Oct 25, 2016
Disable drop and paste in text boxes
View disable-drop-paste.js
function removeDropPaste()
{
jQuery(".numeric").bind("paste", function (e) {
return false;
});
jQuery(".numeric").bind("drop", function (e) {
return false;
});
@sampathsl
sampathsl / README-Template.md
Created Jul 3, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

You can’t perform that action at this time.