Start off by getting up to speed with the docs.
Build an app that calculates the habitability of 5 different astronomical bodies .
Here are the specifications:
- Information about each planet can be acquired from this Firebase endpoint.
| const each = function (collection, iteratee, context) { | |
| if (Array.isArray(collection)) { | |
| for (let [i, el] of collection.entries()) { | |
| iteratee.call(context, el, i, collection) | |
| } | |
| } else { | |
| for (let key in collection) { | |
| if (collection.hasOwnProperty(key)) { | |
| iteratee.call(context, collection[key], key, collection) | |
| } |
| let state = { names: [] } | |
| const reducer = (state, action) => { | |
| switch (action.type) { | |
| case 'ADD_NAME': | |
| return { | |
| ...state, | |
| names: [ | |
| ...state.names, | |
| action.name |
| function findPermutations (arr) { | |
| let results = [] | |
| if (arr.length === 1) { | |
| //base case, if arr === [3] there is only one permutation so permutations is [[3]] | |
| return [arr] | |
| } | |
| for (let i=0; i<arr.length; i++) { | |
| //seperate the pivot from the numbers to permute | |
| let copy = arr.slice() | |
| let pivot = copy.splice(i, 1) |
Start off by getting up to speed with the docs.
Build an app that calculates the habitability of 5 different astronomical bodies .
Here are the specifications:
This was put together after some confusion in how to handle errors in the model. Refer to try catch in promise
try/catch is redundant in promise chains and promise executor functions. Any error thrown is automatically converted to a rejection of the promise you're supposed to return. The promise code calling your function takes care of this.
const asyncValidate = values => new Promise(resolve => {
| //https://www.codewars.com/kata/square-into-squares-protect-trees/train/javascript | |
| function sumSquares (n) { | |
| function decompose (num, whatsLeft, result) { | |
| if (whatsLeft === 0) return result | |
| while (num * num > whatsLeft) num -= 1 //decrement within the same recursive level until a suitable target is found, this ensures num does not exceed the size of the call stack | |
| if (num === 0) return null | |
| //explore a path in the recursive tree from num-1, assuming num is a result (right) | |
| //if we hit null, pop out to the previous level/s, explore the other path for num-1 where num is not a result | |
| return decompose(num-1, whatsLeft - num * num, [num].concat(result)) || decompose(num-1, whatsLeft, result) |
EGSnrc development occurs on feature branches, which upon review are merged into the develop branch. The develop branch is not officially released, but many users rely on it to work with the latest features, hence commits to develop should be considered permanent (or else corrected immediately).
Preparing to merge a feature branch into develop involves the following steps:
git push --force-with-leaseIssue with accessing server from a remote computer. Refer to sever can't be accessed via IP from remote computer and allow webpack dev server to be externally accessed
First troubleshoot that it wasn't the ip itself causing the problem by setting up a simple http server. This allows you to access the files with http requests.
python -m SimpleHTTPServer 8000
ping http://192.168.1.210:8000/my_file.json
If this works, there's probably something wrong with the webpack build.
Your pair and you have forked a repo. You pair program on your pair's computer. At the end of the day, she pushes the changes to her github repo. You want to pull those changes into your local repo, and then push them to your github repo.
First, configure a remote that points to the upstream (your pair's) repo in git.
Then fetch the changes from the original repo:
git fetch upstream
git checkout <branchname> your fork's local branch you want to rebase the new changes made to the original repo.
Then, rebase.
| //looks like momentJs takes care of daylight savings. | |
| var winterTime = moment('2018-04-18T07:46:15Z').format('YYYY-MM-DD h:mm:ss') | |
| var summerTime = moment('2018-03-02T08:53:47Z').format('YYYY-MM-DD h:mm:ss') | |
| var sixMonthsAgo = moment().subtract(6, 'months').calendar() | |
| console.log('-------dates--------') | |
| console.log(winterTime) | |
| console.log(summerTime) |