Friday 26 June 2015

javascript

date object

var today = new date(); // return todays date

to make out own obj

we can we

var day= new Date(2011,0,1);// year month and day , month as an exception starts as 0

var daytime= new Date(2011,0,1,0,0,0);//also adds hours , mins and secs with previous

Get methods of date obj

day.getMonth();
day.getYear();
day.getTime();

Set methods

day.setMonth(5);

comparison

var date1= new Date(2001,1,1);
var date2= new Date(2001,1,1);

if(date1==date2)//false

if(date1.getTime()==date2.getTime())

CREATING NEW OBJECT

var player= new object();

now its data members will be declared as

player.name="fred";
player.age=13;
player.rank=1;

A variable inside a object is called its properties, same as data member

shorthand to create an object

var player= {name: "Fred",age:13,rank:1};







Thursday 25 June 2015

git bash


git config --global user.name "<name>"

git config --global user.email "<email>"

git init <project>
to make the folder working area for git , ie to make it project folder

git log
see changes made through commit

git status
see the staged area , new files that have come up and the files that have changed

git add .
add all the files of folder to the staged area

git add "filename"
add the particular file to the stage area

git commit -m "any comment to indicate the changes that reflect in this commit"

git diff
show the exact changes that have taken place in files (as their lines of code)
but shows only of unstaged files

git diff --cached
after we add a file to the stage area and we want to see the differences then we need to use --cached otherwise the changes wont show

shortcuts
if the log becomes to big , to come out of it we need to press ctrl+z+z or ctrl+c(checked)

git log --oneline
show all commits with just the associated message

git commit -a -m "message"
it will quickly do commit , and also add the files to the staging area (replacement as one line code)

git status -s
show modifications in shorthand

ssh-keygen -t rsa -C "email address"
generates rsa key for computer

ssh -T git@github.com
checks whether the computer is able to communicate with the gitserver or not after using rsa encryption


git  remote add  origin "git repository ssh "
will add the remote repository from where we will push or pull the data


git push origin master
will push everything on remote repository

git branch
ti know  all braches

git brach branchname
to make a new branch

git checkout branchname
to go to that branch

git clone "ssh url"
to clone a project to local

git remote add variablename "ssh " or
git push varialbe name branch name
git push something in a branch

TO merge
git merge master
this will merge the code of master with our branch