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
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>
@super-dog-human
super-dog-human / how_to_connect.md
Last active October 28, 2020 22:07
How to connect Oculus Go controller(OMVR-V190) to macOS 10.12
  1. Prepare a Mac supports BLE
  2. Download the Additional Tools for Xcode from Apple Developer
  3. Open the Bluetooth Explorer
  4. Press and hold the Oculus button and back button of controller until the controller LED blinks
  5. Select menu [Devices] -> [Low Energy Devices]
  6. Click [Start Scanning] button.
  7. Chose OMVR-V190 in Device and click [Connect] button.