Wednesday, September 9, 2015
How to check array in jQuery
var dataarray = ["1", "2", "3"];
if ( $.inArray('1', dataarray) > -1 ) {
alert("checked");
}
How to clone a git branch
Create a new local branch develop and clone from remote branch origin/develop
git checkout -b develop origin/develop
How to list branches
list local branch
git branch
List remote branch
git branch -r
List all branch
git branch -a
How to switch between branch master and develop
git checkout master
git checkout develop
How to copy files/dictionaries from branch develop
git checkout develop files/*
Monday, August 24, 2015
How to remove function from a jQuery object
The function can be removed from a previously-attached event handler.
eg. Remove submit function from a form element.
$('form[name="formname"]').unbind('submit');
Tuesday, July 28, 2015
git problem : You are in the middle of a conflicted merge
Fix merge conflicts
git reset --hard HEAD
git fetch origin
git reset --hard origin
git reset --hard HEAD
git fetch origin
git reset --hard origin
Thursday, July 23, 2015
How to Stop Your Mac Book Pro From Freezing with Keyboard & Trackpad Unresponsive
If you can still toggle caps lock and it dones't freeze in safe mode, you can backup and remove the directory below.
/System/Library/Extenstions/AppleIntelHD5000Graphics.kext
Tuesday, March 24, 2015
How to use Replace & ReplaceAll in Java
Replace character
String newstring = str1.replace("-",",");
Replace string
String newstring = str1.replaceAll("[a-z]","0");
Replace string only for first match
String newstring = str1.replaceFirst("[a-z]","0");
String newstring = str1.replace("-",",");
Replace string
Replace string only for first match
String newstring = str1.replaceFirst("[a-z]","0");
Tuesday, May 13, 2014
Validate Email Addresses With PHP preg_match
$email = "[email protected]"
preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", $email)
or
filter_var($email, FILTER_VALIDATE_EMAIL)
Subscribe to:
Posts (Atom)