TODO: setup SSL.
This is a quick guide on how to setup domain and infinite subdomains, in a case where, for example, you may have one subdomain for each client.
Starting from this http://stackoverflow.com/a/39646701
PUT NICE LINKS HERE |
/* | |
* Usage | |
* let cursor = Test.find().sort({ name: 1 }).cursor(); | |
const get = makeGen(cursor, 100); | |
let first100 = await get.next(); | |
console.log(first100.value.length); | |
https://gist.github.com/lineus/3f7d826a21796129db968d6590c93faa | |
*/ | |
export async function* batchCursor(c, n) { | |
const cursor = c; |
cat .gitconfig 1 ↵ tgmarinho@Thiagos-MacBook-Pro | |
[user] | |
name = Thiago Marinho | |
email = [email protected] | |
[core] | |
editor = code | |
longpaths = true | |
[diff] | |
tool = meld | |
[difftool "meld"] |
import { ethers } from 'ethers' | |
export const isEscrowAddressValid = (param: string) => { | |
try { | |
ethers.utils.getAddress(param) | |
return true | |
} catch (error) { | |
return false | |
} | |
} |
import { Buffer } from 'buffer' | |
export const transformSVGInBase64 = (svgFile: string) => { | |
const imageInBase64 = Buffer.from(svgFile).toString('base64') | |
const imageReadyToTagImg = 'data:image/svg+xml;base64,' + imageInBase64 | |
return imageReadyToTagImg | |
} |
export function stringToUtf16Bytes(escrowId: string) { | |
const bytes = [] | |
for (let position = 0; position < escrowId.length; position++) { | |
const code = escrowId.charCodeAt(position) // x00-xFFFF | |
bytes.push(code & 255, code >> 8) // low, high | |
} | |
return bytes | |
} |
export const groupBy = <T, K extends keyof any>( | |
array: T[], | |
getKey: (item: T) => K | |
) => | |
array.reduce((acc, current) => { | |
const group = getKey(current) | |
if (!acc[group]) acc[group] = [] | |
acc[group].push(current) | |
return acc | |
}, {} as Record<K, T[]>) |
const reduceAddress = (address: string) => { | |
// it's an ens | |
if (address.includes('.')) return address | |
const start = address.substring(0, 6) | |
const middle = '...' | |
const end = address.substring(address.length - 4) | |
return `${start}${middle}${end}` | |
} |
import { intervalToDuration, formatDuration } from 'date-fns' | |
export const countdownChallengePeriod = (expires: Date) => { | |
const start = new Date().getTime() | |
const end = expires.getTime() | |
const durations = intervalToDuration({ | |
start, | |
end, | |
}) |
TODO: setup SSL.
This is a quick guide on how to setup domain and infinite subdomains, in a case where, for example, you may have one subdomain for each client.
Starting from this http://stackoverflow.com/a/39646701