package main | |
import ( | |
"encoding/csv" | |
"encoding/json" | |
"fmt" | |
"io" | |
"os" | |
"strings" | |
) |
use std::io::{self}; | |
use rand::Rng; | |
struct ReadOnly<T>(T); | |
impl<T> std::ops::Deref for ReadOnly<T> { | |
type Target = T; | |
fn deref(&self) -> &T { | |
&self.0 | |
} |
import * as svelte from 'svelte/compiler'; | |
import * as rollup from 'rollup/dist/es/rollup.browser.js'; | |
const PACKAGES_BASE_URL = 'https://unpkg.com'; | |
export async function generateHtmlFromSvelteApp(svelteCode) { | |
const result = await bundleSvelteApp(svelteCode); | |
const code = result.output[0].code; | |
const generateHtml = Function(` | |
${code} |
import redis from "redis"; | |
const redisclient = redis.createClient(); | |
async function distributedDebounce(callback: () => void, args: { ttl: number, key: string }) { | |
// update ttl. | |
await new Promise((resolve, reject) => { | |
redisclient.set(args.key, '', 'PX', args.ttl, (error, result) => { | |
if (error) return reject(error); | |
else return resolve(result); | |
}) |
- get slack legacy api token: https://api.slack.com/legacy/custom-integrations/legacy-tokens
- get spotify oauth token: https://developer.spotify.com/console/get-users-currently-playing-track
- get slack emoji: https://slackmojis.com/categories/2-logo-emojis
setup
$ npm i
※注意※
本稿は、[パーソナリティ障害の本]([https://www.amazon.co.jp/%E3%83%91%E3%83%BC%E3%82%BD%E3%83%8A%E3%83%AA%E3%83%86%E3%82%A3%E9%9A%9C%E5%AE%B3%E2%80%95%E3%81%84%E3%81%8B%E3%81%AB%E6%8E%A5%E3%81%97%E3%80%81%E3%81%A9%E3%81%86%E5%85%8B%E6%9C%8D%E3%81%99%E3%82%8B%E3%81%8B-PHP%E6%96%B0%E6%9B%B8-%E5%B2%A1%E7%94%B0-%E5%B0%8A%E5%8F%B8/dp/4569635253/ref=asc_df_4569635253/?tag=jpgo-22&linkCode=df0&hvadid=296017455562&hvpos=&hvnetw=g&hvrand=1595219051149364207&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1009341&hvtargid=pla-717633598512&psc=1&th=1&psc=1](https://www.amazon.co.jp/%E3%83%91%E3%83%BC%E3%82%BD%E3%83%8A%E3%83%AA%E3%83%86%E3%82%A3%E9%9A%9C%E5%AE%B3%E2%80%95%E3%81%84%E3%81%8B%E3%81%AB%E6%8E%A5%E3%81%97%E3%80%81%E3%81%A9%E3%81%86%E5%85%8B%E6%9C%8D%E3%81%99%E3%82%8B%E3%81%8B-PHP%E6%96%B0%E6%9B%B8-%E5%B2%A1%E7%94%B0-%E5%B0%8A%E5%8F%B8/dp/4569635253/ref=asc_df_4569635253/?tag=jpgo-22&linkCode=df0&hvadid=296017455562&hvpos=&hvnetw=g&hvrand=1595219051149364207&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdv
const Module = require('module'); | |
const originalRequire = Module.prototype.require; | |
const performance = require('perf_hooks').performance | |
Module.prototype.require = function(){ | |
const now = performance.now() | |
const res = originalRequire.apply(this, arguments) | |
console.log({ filename: this.filename, time: performance.now() - now }) | |
return res | |
}; |
/// <reference types="Cypress" /> | |
export default async function retry(retryable, { times } = { times: 3 }) { | |
return await _retry(retryable, { times, wait: 1000, waitScale: 1 }); | |
} | |
async function _retry(retryable, { times, wait, waitScale }) { | |
try { | |
return await retryable() | |
} catch(e) { |