- Create a GitHub account on github.com.
- Download either [GitHub for Mac][1] or [GitHub for Windows][2], depending on your operating system. Open the app and log in using the account you just created.
- (On Mac): After you login, click advanced and make sure that your name and email are correct. Then, click "Install Command Line Tools", just in case you want to start using the command line later in life.
- Create a new repository in your GitHub application. Name it your-username.github.io. The name is very important. Note the folder that GitHub is saving the repository to. Make sure the "Push to GitHub?" box is checked.
- Move your website's files into the folder that GitHub just created when you made the repository. IMPORTANT: Your homepage HTML file must be called "index.html", and it must exist in the top-level directory.
- Back in the GitHub application, you should see your files in the left column. Make sure they are all checked. If so, enter a mess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function solution(S) { | |
var arr = []; | |
var K = 0; | |
for (var i=0; i<S.length; i++) { | |
if (S[i]=='(') { | |
arr.push(S[i]); | |
} else { | |
if(arr.length){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myArray = [ | |
{id: 1, name: 'Abhinav', email: '[email protected]'}, | |
{id: 2, name: 'Aviral', email: '[email protected]'}, | |
{id: 3, name: 'Jitendra', email: '[email protected]'}, | |
{id: 4, name: 'Rajesh', email: '[email protected]'}, | |
{id: 5, name: 'Abhinav', email: '[email protected]'}, | |
{id: 6, name: 'Akash', email: '[email protected]'}, | |
]; | |
let arrayCopy = JSON.parse(JSON.stringify(myArray)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const problemSolution = function(str){ | |
let val = str.split(''), | |
stack = [], | |
count = 0; | |
stack.push(val[0]); | |
for(let i=1; i< val.length; i++) { | |
if((/[a-z]/.test(stack[stack.length-1])) && (/[a-z]/.test(val[i]))) { | |
console.log('1'+ val[i]); | |
return count; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function value(funcName) { | |
if(typeof funcName !== 'function') { | |
return funcName; | |
let func = funcName(); | |
let resp = typeof func === 'function' ? value(func) : func; | |
return resp; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatten = function(inputObj) { | |
var respObj = {}; | |
for (let i in inputObj) { | |
if (!inputObj.hasOwnProperty(i)) continue; | |
if ((typeof inputObj[i]) == 'object') { | |
let flatObject = flatten(inputObj[i]); | |
for (let x in flatObject) { | |
if (!flatObject.hasOwnProperty(x)) continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function towerOfHanoi(source, helper, target) { | |
function moveDisks(n, innerSource, innerHelper, innerTarget) { | |
if (n <= 0) { | |
return; | |
} | |
moveDisks(n - 1, innerSource, innerTarget, innerHelper); | |
innerTarget.push(innerSource.pop()); | |
moveDisks(n - 1, innerHelper, innerSource, innerTarget); | |
} | |
moveDisks(source.length, source, helper, target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findSecondLargest(arr) { | |
let max = arr[0]; | |
let secondMax = arr[0]; | |
arr.forEach((elem) => { | |
if(elem > max) { | |
secondMax = max; | |
max = elem; | |
} else if(elem<max && elem>secondMax) { | |
secondMax = elem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1 | |
let obj = { | |
a: 1, | |
b: { | |
c: 2, | |
}, | |
} | |
let newObj = JSON.parse(JSON.stringify(obj)); | |
obj.b.c = 20; |
- You type an URL into address bar in your preferred browser.
- The browser parses the URL to find the protocol, host, port, and path and it forms a HTTP request (that was most likely the protocol).
- To reach the host, it first needs to translate the human readable host into an IP number, and it does this by doing a DNS lookup on the host
- Then a socket needs to be opened from the user’s computer to that IP number, on the port specified (most often port 80)
- When a connection is open, the HTTP request is sent to the host
- The host forwards the request to the server software (most often Apache) configured to listen on the specified port
- The server inspects the request (most often only the path), and launches the server plugin needed to handle the request (corresponding to the server language you use, PHP, Java, .NET, Python?)
- The plugin gets access to the full request, and starts to prepare a HTTP response.
- To construct the response a database is (most likely) accessed. A database search is
OlderNewer