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
{ | |
"name": "date_trader", | |
"version": "0.0.1", | |
"description": "Basic CRUD template in React and Redux", | |
"main": "index.js", | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test --env=jsdom", | |
"eject": "react-scripts eject" |
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
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"node": true, | |
"jest": true | |
}, | |
"extends": [ | |
"airbnb", | |
"plugin:jsx-a11y/recommended", |
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 solution(X, Y, D) { | |
let range = (Y - X); // max distance to go | |
// special cases | |
let hops = D === Y ? 0 : parseInt(range / D); // whole jumps [1] | |
let extra = range % D; // any left over hops required | |
console.log(`===>| X:${X} | Y:${Y} | D:${D} | range:${range} | hops:${hops} | extra:${extra} |`) | |
return extra ? hops + 1 : hops | |
} | |
// [1] parseInt() [at least in Chrome] exhibits wonky behavior when working with small fractions. For example: |
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
// ===== ANSWER: | |
function solution(A) { | |
let set = new Set(); // holds a unique set of values | |
let max = 1; // largest number in set | |
let min = 1; // smallest number in set | |
let n = A.length | |
for (let i = 0; i < n; i += 1) { | |
let num = A[i]; |
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
// ===== ANSWER | |
function solution(H) { | |
// write your code in JavaScript (Node.js 8.9.4) | |
let stack = []; | |
let count = 0; | |
let height = 0; | |
// adds a block to the stack when value exceeds current height | |
const addBlock = (value) => { |
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
{ | |
"color_scheme": "Packages/Color Scheme - Default/iPlastic.tmTheme", | |
"font_size": 16, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"rulers": | |
[ | |
70 |
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
http://kbroman.org/github_tutorial/pages/init.html | |
git/github guide | |
**Start a new git repository** | |
Your first instinct, when you start to do something new, should be git init. You’re starting to write a new paper, you’re writing a bit of code to do a computer simulation, you’re mucking around with some new data … anything: think git init. | |
A new repo from scratch | |
Say you’ve just got some data from a collaborator and are about to start exploring it. | |
Create a directory to contain the project. | |
Go into the new directory. |
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
`rails new (Application Name) -d postgresql -T |
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
Lesson 1 - Iterations | |
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/ | |
Lesson 2 - Arrays | |
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/ | |
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/ | |
Lesson 3 - Time Complexity | |
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/ | |
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/ |
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
// Example implementation: http://jsfiddle.net/2f7w2fpn/ | |
var indent = 1; | |
function walk(tree) { | |
tree.forEach(function(node) { | |
console.log('--' + Array(indent).join('--'), node.key); | |
if(node.children) { | |
indent ++; | |
walk(node.children); | |
} |
NewerOlder