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
export const haversine = (coordinates1: [number, number], coordinates2: [number, number]) => { | |
const [ lat1, lon1 ] = coordinates1; | |
const [ lat2, lon2 ] = coordinates2; | |
const radian = (value: number) => value * (Math.PI / 180); | |
const dLat = radian(lat2 - lat1); | |
const dLon = radian(lon2 - lon1); | |
const result = Math.sin(dLat / 2) |
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
interface DotObjectOptions { | |
ignoreArrays?: boolean | |
} | |
export const dotObject = (object: Record<string, unknown>, options: DotObjectOptions = {}) => { | |
if (!object || typeof object !== 'object') { | |
throw Error('Not a object'); | |
} |
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
[ | |
{ | |
"code": "001", | |
"name": "banco do brasil" | |
}, | |
{ | |
"code": "341", | |
"name": "itaú" | |
}, | |
{ |
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
#!/usr/bin/env perl | |
######################### | |
# MongoDB Backup Script # | |
######################### | |
# | |
# A simple script for automate MongoDB backup | |
# Use this script in cron routine like example: | |
# | |
# 0 1 * * * /path/mongodb-backup.pl --hostname localhost >/dev/null 2>&1 |
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 _ from 'lodash'; | |
class MergeUpdate { | |
save(original, update) { | |
// Update timestamp manually | |
if (original.updatedAt) { | |
update.updatedAt = new Date().toISOString(); | |
} |
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
[ | |
{ | |
"_id": "59ada9772bc5be4a37aaa435", | |
"name": "Banco ABC Brasil S.A.", | |
"febraban": true, | |
"clearing": true, | |
"code": "246", | |
"alias": null | |
}, | |
{ |