In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:
- Separate big codebases into multiple repositories.
/* | |
* Demonstrate JavaScript floating point math bugs by showing | |
* which two-decimal-place numbers between 0.00 and 1.00 inclusive | |
* have fractional parts after being multiplied by one hundred. | |
*/ | |
var i = 0.00; | |
for (n = 0; n <= 100; ++n) { | |
j = i * 100; | |
if (Math.round(j) != j) { |
/* *-*-*-*-*-*-*-*-*-*-* Challenge 1 ------------------ | |
Create a variable with the type number and assign it an arbitrary value | |
*/ | |
// ---------------------------------------------------- | |
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- | |
// ---------------------------------------------------- | |
/* *-*-*-*-*-*-*-*-*-*-* Challenge 2 ------------------ | |
Create a variable with the type string and use the addition operator to put two arbitrary words together | |
*/ |
that I bookmarked but never had enough time to read
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])) { |
const store = createStore((state = { counter: 0 }, action) => { | |
switch(action.type) { | |
case "INCREMENT": | |
return { counter: state.counter + 1 } | |
case "DECREMENT": | |
return { counter: state.counter - 1 } | |
default: | |
return state | |
} | |
}) |
[ | |
{ "country": "Austria", "code": "AT" }, | |
{ "country": "Belgium", "code": "BE" }, | |
{ "country": "Bulgaria", "code": "BG" }, | |
{ "country": "Croatia", "code": "HR" }, | |
{ "country": "Cyprus", "code": "CY" }, | |
{ "country": "Czech Republic", "code": "CZ" }, | |
{ "country": "Denmark", "code": "DK" }, | |
{ "country": "Estonia", "code": "EE" }, | |
{ "country": "Finland", "code": "FI" }, |
pragma solidity ^0.4.19; | |
contract ERC721 { | |
string constant private tokenName = "My ERC721 Token"; | |
string constant private tokenSymbol = "MET"; | |
uint256 constant private totalTokens = 1000000; | |
mapping(address => uint) private balances; | |
mapping(uint256 => address) private tokenOwners; | |
mapping(uint256 => bool) private tokenExists; | |
mapping(address => mapping (address => uint256)) private allowed; | |
mapping(address => mapping(uint256 => uint256)) private ownerTokens; |