Monday, 17 August 2015

Edit an commit message in Github Repository - Commands

Question: How to change the Most recent commit message?
git commit --amend -m "This is updated commit message"


Question: How to change the Most recent commit message and append the files
git commit -a --amend -m "This is updated commit message"


How to display the status of files in the index versus the working directory?
git status; //;On branch test


How to create new Github directory?
git init <directory></directory>


How to get checkout from GitHub URL?
git clone /path/to/repository


Question: How to Add a files in github?
git add <files></files>


Question: How to commit the files in github?
git commit


Question: How to Push to a repository
git push origin


Question: HOw to git push in origin branch?
To push to your branch


Question: How to transfer all changes in your github?
git add file.txt
git commit  -m "We are add file.txt"
git push


Question: How to add file with commit message?
git add file.txt commit -m "We are add file.txt"


Question: How to pull all the changes ?
git pull origin


Thursday, 13 August 2015

How do you get a timestamp in JavaScript?

How do you get a timestamp in JavaScript?

Question: What is timestamp?
timestamp is the current time of an event that is recorded by a computer. In JavaScript, it gives local time (computer ).


Question: How do you get a timestamp in JavaScript?
Date.now()



Question: How do you get a timestamp in number of seconds?
Math.floor(Date.now() / 1000)



Question: How do handle exception to this is IE8 and other Browser?

if (!Date.now) {
Date.now()
}



Question: How do you get the date from the time object
new Date().getDate()



Question: What are other date-functions in javascript?
getDate(): Get the day as a number (1-31)
getDay(): Get the weekday as a number (0-6)
getFullYear(): Get the four digit year (yyyy)
getHours(): Get the hour (0-23)
getMilliseconds(): Get the milliseconds (0-999)
getMinutes(): Get the minutes (0-59)
getMonth(): Get the month (0-11)
getSeconds(): Get the seconds (0-59)
getTime(): Get the time (milliseconds since January 1, 1970)