Skip to content

Instantly share code, notes, and snippets.

View konojunya's full-sized avatar

JJ konojunya

View GitHub Profile
@konojunya
konojunya / image-upload.ts
Created February 12, 2021 03:06
Next.js file uploader with busboy
import { NextApiRequest, NextApiResponse } from 'next';
import Busboy from 'busboy';
import { inspect } from 'util';
export const config = {
api: {
bodyParser: false,
},
};
@konojunya
konojunya / title.md
Last active March 19, 2020 01:24
sample markdown

h1

h2

h3

h4

text

@konojunya
konojunya / download.js
Last active March 10, 2019 06:08
file download javascript
function download(url, filename){
var xhr = new XMLHttpRequest(),
a = document.createElement('a'), file;
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = function () {
file = new Blob([this.response], { type : 'application/octet-stream' });
a.href = window.URL.createObjectURL(file);
a.download = filename;
@konojunya
konojunya / count_working_time.js
Created August 14, 2018 16:32
TodoのDoneに入ったissueの時間を数えるJSワンライナー
var result = {}; Object.keys(Object.keys(document.querySelectorAll(".project-column")[Object.keys(document.querySelectorAll(".project-column")).filter(key => document.querySelectorAll(".project-column")[key].getElementsByTagName("h4")[0].querySelector(".js-project-column-name").innerText === "Done")].children).map(i => document.querySelectorAll(".project-column")[Object.keys(document.querySelectorAll(".project-column")).filter(key => document.querySelectorAll(".project-column")[key].getElementsByTagName("h4")[0].querySelector(".js-project-column-name").innerText === "Done")].children[i]).filter(i => i.classList.contains("js-project-column-cards"))[0].children).map(i => Object.keys(document.querySelectorAll(".project-column")[Object.keys(document.querySelectorAll(".project-column")).filter(key => document.querySelectorAll(".project-column")[key].getElementsByTagName("h4")[0].querySelector(".js-project-column-name").innerText === "Done")].children).map(i => document.querySelectorAll(".project-column")[Object.ke
@konojunya
konojunya / router.go
Created July 17, 2018 12:09
cors golang
r := gin.Default()
r.Use(cros)
func cros(c *gin.Context) {
headers := c.Request.Header.Get("Access-Control-Request-Headers")
c.Header("Access-Control-Allow-Origin", "*")
c.Header("Access-Control-Allow-Methods", "GET,POST,PUT,HEAD,PATCH,DELETE,OPTIONS")
c.Header("Access-Control-Allow-Headers", headers)
if c.Request.Method == "OPTIONS" {
c.Status(200)
@konojunya
konojunya / main.go
Last active November 21, 2022 09:54
Sample using gin's BindJSON
package main
import (
"fmt"
"log"
"github.com/gin-gonic/gin"
)
type CreateParams struct {
@konojunya
konojunya / tinder_auto_like.js
Created March 28, 2018 13:39
Tinderのいいねを自動化するスクリプト(consoleに貼ると動きます)
var like_button = document.querySelector(".recsGamepad__button--like ");
function like() {
like_button.click()
setTimeout(like, 1000)
}
like()
@konojunya
konojunya / memo.md
Created March 22, 2018 13:03
Goで画像をAAに変えるやつ