Dev Notes

JavaScript Function Crib Sheet

Wed May 8, 2013

Getting Lazy! So created a javascript function cheat sheet to share with the travellers here. Hope it will be help many of you.

The cryptsheet includes these functions and can be found here : https://github.com/alfredkam/jsFunctions

General Laziness::
- jquery toggle string
- jquery enter keyup event

Mathematical Functions::
- n choose r
- Binomial Distribution
- Probability Mass Function (Useful when wanted to create a bell curve)
- Summation

If the function your missing is not listed, comment below and i may be able to write one.

CSS Cheat Sheet

Wed Mar 6, 2013

css wildcards

css goodies from the net

CheckBox
Dust Particles
Loading Effect
Pure css3 dial clock

Allow password authentications on Amazon ec2 instance

Sat Feb 9, 2013

Step 1 - ssh into server


ssh -i ssh_key.pem my_amazon_ec2_instance.url

*This is really not a recommended way to login

Searchable Hash Bang (SEO)

Fri Feb 1, 2013

Having a dynamic website, AJAX is often used and rely on hash bang to act as a http GET to let the site be interactive. Inorder to have your application searchable / crawable, there are couple of rules to follow as suggested by the google specs.

Assuming your too lazy to checkout the specs. In summary the hash bang should be setup this way:

In a typical site, you will notice the url with http GET are written in this format

http://yoursite.com?key1=value1&key2=value2

Now in your hashbang, your will want to transform

http://yoursite.com#value1&value2

into beautiful url

http://yoursite.com#!key1=value1&key2=value2

Git Cheat Sheet

Mon Dec 17, 2012


#Setting up git from scratch
git init                                             #initialize git
git remote add < remote_label > < destination >      #adds a new remote destination with a label
git fetch < remote_label >                           #fetches the head of the repo
git checkout master                                  #checkouts the master branch

#Setting up git from another repo git clone < remote_label > < optional_dir_location > #clone a repo with git config ready

#Branching git branch #list all branches git branch < branch_label > #creates a new local branch with name < branch_label > git branch -d < branch_label > #deletes the local branch with name < branch_label > git push < remote_label> :< branch_label > #deletes remote branch

#Merging git checkout < branch to be merge >
git merge < branch_name > #merge recursively and auto commit

additional info - git merge man page

#fetch & pulling git pull < remote_label > < branch_label> #it will recursively merge with your repo git fetch < remote_label >

#Commit git commit -a -m < message > #local commit git commit -amend -m < message > #edit last commit message git push < remote_label > < branch_label > #commits to remote branch

#Tagging git tag -a < comment > #to remember a specific point git push –tag #pushes tag

#To delete a tag git tag -d < tag_name > git push origin :< tag_name >

#if tag name is same as one of your branch name git tag -d < tag_name > git push origin :refs/tag/< tag_name >

#Logging git log #shows the commit log

#Untrack a file git rm –cache < file_name > #untracks a file, thus not included in repo

#Stashing git stash

#cloning a bare repo for deployment purpose git clone –bare

additional info git stash man page


#reverting to previous commits  [Advance]
git checkout < commit_hash >                     #checkout the indicated commit hash
git checkout -b < branch_label > < commit_hash>  #branches with < branch_label > and checkout to the commit hash
git reset –hard < commit_hash >                 #destroys the local modification, you will loose the uncommit work
git revert < commit_hash >                       #reverts to the previous commit

additional info - git revert man page & stack over flow git revert qa


#splitting a subpath out into a new repo
git filter-branch –prune-empty –subdirectory-filter lib master

additional info - github:help