git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
package pt.impresa.iweb.filters.request; | |
import java.io.IOException; | |
import java.text.Normalizer; | |
import java.util.Collections; | |
import java.util.Enumeration; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.regex.Pattern; |
angular.module('app', []) | |
.factory('FakeAmazonService', function($http, $q) { | |
return { | |
validateShippingAdddress: function(address) { | |
var deferred = $q.defer(); | |
$http.post('/api/address/validate', address) | |
.then(function(resp) { | |
deferred.resolve({ success: true, data: resp}); | |
}), | |
function(error) { |
// 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); | |
} |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
Implementation of redux inside any react.js or react-native application,
/* | |
* forEach | |
*/ | |
// forEach is very simlar to for-looping arr.length | |
// array.forEach(callback, context) | |
var arr = ['apple', 'orange', 'watermelon', 10, 20, 30] | |
arr.forEach((value, index) => console.log(`Element's ${index} type is ${typeof value}`)) | |
// Prints: | |
// Element 0 type is string |
class Person { | |
constructor(name = 'Anonymous', age = 0) { | |
this.name = name | |
this.age = age | |
} | |
getGreeting(){ | |
return `Hi, I am ${this.name}` | |
} | |
getDescription(){ | |
return `${this.name} is ${this.age} years old` |