Skip to content

Instantly share code, notes, and snippets.

@holyshared
holyshared / prog.ts
Created October 16, 2022 08:32
form-data for multipart/mixed
import fs from "fs";
import path from "path";
import FormData from 'form-data';
const main = async () => {
const file = fs.readFileSync(path.resolve(__dirname, '../../scripts/example.txt.zip'));
const form = new FormData();
form.append('data', file.toString('base64'), {
filename: 'example.txt.zip',
@holyshared
holyshared / main.ts
Created May 18, 2021 05:07
awilix example
import { createContainer, asValue, asFunction, asClass } from "awilix";
// 関数で生成する
// 引数は予めコンテナで設しておく
const loggerFactory = ({ path }: { path: string }) => {
return {
path
};
};
const al = (n) => {
let r = n;
for (let i = 1; i <= n - 1; i++) {
r = r * i;
}
return r;
};
console.log(al(2));
console.log(al(3));
@holyshared
holyshared / pattern.js
Last active March 13, 2021 07:11
Pattern
const items = [1, 2, 3];
function pattern(items, paths, results) {
if (items.length === 0) {
results.push([ ...paths ]);
return results
}
let curr = results;
for (let i = 0; i < items.length; i++) {
paths.push(items[i]);

imgix-core-js

node_modules
node_modules

blueimp-load-image example