Skip to content

Instantly share code, notes, and snippets.

View wxs77577's full-sized avatar

Johnny Wu wxs77577

View GitHub Profile
@wxs77577
wxs77577 / node-fetch-form-data.mjs
Created August 13, 2021 03:10
node-fetch使用form-data上传文件
import FormData from 'form-data'
import { readFileSync } from 'fs'
import fetch from 'node-fetch'
const url = 'https://test.com/api'
const name = 'avatar'
const file = readFileSync('./avatar.jpg')
const form = new FormData()

{ "name": "nest-test", "version": "0.0.1", "description": "", "author": "", "license": "MIT", "scripts": { "build": "tsc -p tsconfig.build.json", "format": "prettier --write "src//*.ts" "test//.ts" "libs/**/.ts"", "start": "ts-node -r tsconfig-paths/register src/main.ts",

@wxs77577
wxs77577 / main
Created June 3, 2020 03:29
vscode-settings
test
import { ModelType } from "@hasezoey/typegoose/lib/types";
import { CrudRequest, CreateManyDto, GetManyDefaultResponse, CrudService } from "@nestjsx/crud";
import { BadRequestException, NotFoundException } from "@nestjs/common";
import { mongoose } from "@hasezoey/typegoose";
export class MongooseCrudService<T> extends CrudService<T> {
constructor(public model: ModelType<T>) {
super()
}
@wxs77577
wxs77577 / shell.md
Created October 23, 2018 09:31
常用命令
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
@wxs77577
wxs77577 / express-async.js
Created August 4, 2017 10:05
Express with Async Mongodb
const MongoClient = require('mongodb').MongoClient
const express = require('express')
const multer = require('multer')
const bodyParser = require('body-parser')
const upload = multer({ dest: 'uploads/' })
const router = express.Router()
const app = express()
app.use(bodyParser.json())
@wxs77577
wxs77577 / qzw.js
Last active August 3, 2017 06:40
【NodeJS】找出千字文(简体版)中重复的字
require('fs').readFileSync('qzw.txt', 'utf-8')
.replace(/\s+/g, '')
.split('')
.sort((a, b) => {
return a.charCodeAt() - b.charCodeAt()
}).forEach((v, k, arr) => {
if (k > 1 && v === arr[k - 1]) {
console.log(v);
}
})
@wxs77577
wxs77577 / swiper-zoomable-pagination.html
Last active March 15, 2017 02:41
Swiper Zoomable (Scalable) Pagination
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="http://github.com/wxs77577">
<link href="https://cdn.bootcss.com/Swiper/3.4.1/css/swiper.css" rel="stylesheet">
<style>
.swiper-slide{
@wxs77577
wxs77577 / goto-sublime
Created September 26, 2016 14:20 — forked from kendellfab/goto-sublime
Add mouse click `goto definition` in sublime text 3.
Linux - create "Default (Linux).sublime-mousemap" in ~/.config/sublime-text-3/Packages/User
Mac - create "Default (OSX).sublime-mousemap" in ~/Library/Application Support/Sublime Text 3/Packages/User
Win - create "Default (Windows).sublime-mousemap" in %appdata%\Sublime Text 3\Packages\User
[
{
"button": "button1",
"count": 1,
"modifiers": ["ctrl"],
"press_command": "drag_select",