This file contains hidden or 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
{ | |
"data": { | |
"currentAge": 36.80011267063039, | |
"yearsLeft": 43.607894089607434, | |
"monthsLeft": 523.2947290752892, | |
"daysLeft": 15927.783316229115, | |
"hoursLeft": 382266.7995894988, | |
"minutesLeft": 22936007.975369927, | |
"secondsLeft": 1376160478.5221956, | |
"dateString": "43 years 7 months 8 days 23 hours 17 minutes 42 seconds", |
This file contains hidden or 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
// Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted: | |
export const getLastItemInMap = map => Array.from(map)[map.size-1] | |
export const getLastKeyInMap = map => Array.from(map)[map.size-1][0] | |
export const getLastValueInMap = map => Array.from(map)[map.size-1][1] | |
// Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity. |
This file contains hidden or 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
Got this issue today on windows, but don't need to downgrade node, just as discussed on stackoverflow just need to change some hashes on your project: | |
\node_modules\metro-config\src\defaults\blacklist.js | |
var sharedBlacklist = [ | |
/node_modules[/\\]react[/\\]dist[/\\].*/, | |
/website\/node_modules\/.*/, | |
/heapCapture\/bundle\.js/, | |
/.*\/__tests__\/.*/ | |
]; |
This file contains hidden or 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
//note: month is 0 based, just like Dates in js | |
function getWeeksInMonth(month, year){ | |
var weeks=[], | |
firstDate=new Date(year, month, 1), | |
lastDate=new Date(year, month+1, 0), | |
numDays= lastDate.getDate(); | |
var start=1; | |
var end=7-firstDate.getDay(); | |
while(start<=numDays){ |
This file contains hidden or 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
import * as RNIap from 'react-native-iap'; | |
RNIap. getPurchaseHistory().then((purchaseHistory) => { | |
if(purchaseHistory.length > 0) { | |
const getLastPurchase = purchaseHistory[purchaseHistory.length -1]; | |
const getReceipt = getLastPurchase.transactionReceipt; | |
// DO RECEIPT RELATED TASK | |
} | |
}); |
This file contains hidden or 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 mixed $a | |
* @param mixed $b | |
* | |
* @return int | |
*/ | |
protected function _sortSizes($a, $b) | |
{ | |
$aUpper = strtoupper($a); | |
$bUpper = strtoupper($b); |
This file contains hidden or 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
<?php | |
class ObjectSize { | |
protected static $sizes = [ | |
'xxxxl', | |
'xxxl', | |
'xxl', | |
'xl', | |
'l', |
OlderNewer