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

<br> ssh -i ssh_key.pem my_amazon_ec2_instance.url<br>

*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
<br> http://yoursite.com?key1=value1&amp;key2=value2<br>
Now in your hashbang, your will want to transform
<br> http://yoursite.com#value1&amp;value2<br>
into beautiful url
<br> http://yoursite.com<strong>#!key1=value1&amp;key2=value2</strong><br>

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<p></p>

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

<p>#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</p>

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

<p>additional info - <a href="http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" title="git merge">git merge man page</a></p>

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

<p>#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</p>

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

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

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

<p>#Logging
git log                                        #shows the commit log</p>

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

<p>#Stashing
git stash</p>

#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<p></p>

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