Skip to content

Instantly share code, notes, and snippets.

View super-dog-human's full-sized avatar

onishi.hironori super-dog-human

  • ZYGOPTERA
  • Japan
View GitHub Profile

UEFI

  • turn off Secure Boot

boot from USB stick

  • connect USB stick
  • press F12

initial settings

credential.helper=osxkeychain
diff.noprefix=true
alias.s=status
alias.co=checkout
alias.ci=commit
alias.st=status
alias.br=branch
.zshrc
```
export LANG='ja_JP.UTF-8'
export PATH=/usr/local/git/bin:/usr/local/sbin:$PATH
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
PROMPT=\$vcs_info_msg_0_'%# '

Environments

  • M1 mac
  • Ruby 2.7.4
  • Rails 6(latest)
  • MySQL 5.7

Files

Dockerfile

@super-dog-human
super-dog-human / cloudTasks.go
Last active July 15, 2022 11:25
If your service on app engine runnning as not "default service" and getting NOT_FOUND error, this gist will help.
func CreateTask(projectID, locationID, queueID, relativeUri, message string) (*taskspb.Task, error) {
ctx := context.Background()
client, err := cloudtasks.NewClient(ctx)
if err != nil {
return nil, err
}
defer client.Close()
queuePath := fmt.Sprintf("projects/%s/locations/%s/queues/%s", projectID, locationID, queueID)
package domain
import (
"encoding/json"
"reflect"
"strings"
)
func MergeJsonToStruct(jsonDiff *map[string]interface{}, origin interface{}, allowFields *[]string) {
allKeys := TopLevelStructKeys(origin)
@super-dog-human
super-dog-human / fetch_timeout_abort.js
Last active May 4, 2021 01:30
fetch with timeout and aborting with using React hooks
import { useRef, useEffect } from 'react'
export default function useFetch() {
const abortsRef = useRef({})
function fetchFoo() {
return requestWithAbort(signal => fetch('/foo', { signal }))
}
function fetchBar() {

Three.js has many example files under examples directory not src.

To use there from Next.js, We needs to small tweak config.

// next.config.js
const path = require('path')

module.exports = {
 webpack: (config) => {
@super-dog-human
super-dog-human / lamejs_in_web_worker_with_audioworklet.md
Last active January 31, 2021 00:31
how to use lamejs in web worker with audioWorklet

based on https://github.com/zhuker/lamejs/tree/master/worker-example .

// mic.js

const stream = await navigator.mediaDevices.getUserMedia({audio: true});
const context = new AudioContext();
const microphone = context.createMediaStreamSource(stream);
await context.audioWorklet.addModule('/voiceRecorderProcessor.js')
const recorder = new AudioWorkletNode(context, 'recorder');
@super-dog-human
super-dog-human / requestAnimationFrame_with_scroll-behavior_smooth.md
Last active April 3, 2021 01:09
scroll in requestAnimationFrame is not working at chrome

In Chrome 87, scrolling with "scroll-behavior: smooth" is not working from requestAnimationFrame.

CodePen: https://codepen.io/superdoghuman/pen/ExgzjXP

<div id="parent">
  <div class="child">1</div>
  <div class="child">2</div>
  <div class="child">3</div>