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 randomNumber(maxNum) { | |
return Math.floor((maxNum * Math.random()) + 1); | |
} | |
function randomRgb() { | |
var r = randomNumber(256), | |
g = randomNumber(256), | |
b = randomNumber(256); | |
return 'rgb(' + |
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
{ | |
"workbench.colorTheme": "Night Owl", | |
"workbench.iconTheme": "material-icon-theme", | |
"editor.fontSize": 16, | |
"window.zoomLevel": 1.3, | |
"terminal.integrated.fontSize": 14, | |
"editor.fontFamily": "Fira Code", | |
"editor.fontLigatures": true, | |
//enable emmet on js | |
"emmet.includeLanguages": { |
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
# when running folders with space | |
mypwd=$(pwd); docker run -p 8080:3000 -v ${mypwd}:/var/www -w "/var/www" node npm start | |
# folders without space | |
docker run -p 8080:300 -v $(pwd):/var/www -w "/var/www" node npm start | |
# interactive mode with bash | |
docker run -it -p 8080:3000 -v $(pwd):/var/www -w "/var/www" node /bin/bash | |
# building docker images |
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
# when git is not working. (another git process) | |
rm -f .git/index.lock | |
# triangular workflow. (pull from original repo, push from your forked repo) | |
# clone original repo, set push to your forked repo | |
git remote set-url origin [email protected]:nnja/advanced-git-exercises.git | |
git remote set-url --push origin [email protected]:jcunanan05/advanced-git-exercises.git | |
# when you get EOF error https://stackoverflow.com/questions/21277806/fatal-early-eof-fatal-index-pack-failed | |
git config --global core.compression 0 |
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
/** | |
* war.js | |
* Algorithm complexity might be O(n + 4). 4 Lookups + 1 Loop | |
*/ | |
const CARD_ORDER = 'AKQJT98765432'; | |
function war(handA, handB) { | |
let totalScore = 0; |
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 staircase(stairSteps) { | |
function fibonnaci(n) { | |
if(n <= 1) return 1; | |
else { | |
return fibonnaci(n - 1) + fibonnaci(n - 2); | |
} | |
} | |
return fibonnaci(stairSteps); | |
} |
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
// Display detail page for a specific Author. | |
exports.author_detail = async function(req, res) { | |
// async.parallel( | |
// { | |
// author: function(callback) { | |
// Author.findById(req.params.id).exec(callback); | |
// }, | |
// author_books: function(callback) { | |
// Book.find({ author: req.params.id }, "title summary").exec(callback); | |
// } |
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
// Complete the jumpingOnClouds function below. | |
function jumpingOnClouds(cloudList) { | |
const SAFE = 0; | |
const DANGER = 1; | |
let stepCount = 0; | |
// loop through the array | |
for ( | |
let i = 0, | |
totalSteps = cloudList.length -1; | |
i < totalSteps; |
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
# enable installation | |
sudo spctl --master-disable |
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
/** | |
* | |
* @param {*} menuEnd - navbar right side. | |
* @param {*} renderDrawer({ isOpen, closeDrawer }) - render prop drawer component | |
* @param {object} classes - styles injected | |
*/ | |
class Navbar extends Component { | |
state = { | |
isDrawerOpen: false, |
OlderNewer