Skip to content

Instantly share code, notes, and snippets.

View craftzdog's full-sized avatar
🏠
Working from home

Takuya Matsuyama craftzdog

🏠
Working from home
View GitHub Profile
@sergous
sergous / zustandStoreLogger.ts
Last active May 24, 2024 02:21
Zustand Redux-Like logger middleware
// Zustand Redux-Like logger middleware
//
// Based on https://github.com/itsramiel/zustand-logger-middleware and
// https://github.com/pmndrs/zustand/discussions/788#discussioncomment-7663573
//
// Require all store actions to be scoped in 'actions':
//
// const uiStoreCreator = (set, get) => {
// return {
// uiState: get()?.uiState || defaultUiState,
@jstoone
jstoone / kill-ios-web-content.sh
Last active April 11, 2024 07:41
Kill WebKit.WebContent on Simulator
#/bin/bash
# Find process with name containing 'launchd_sim'
SIMULATOR_PID=$(pgrep launchd_sim)
echo "Simulator PID: $SIMULATOR_PID"
# Find sub-processes for the app's WebViews
WEBKIT_CONTENT_PID=$(pgrep -P $SIMULATOR_PID 'com.apple.WebKit.WebContent')
echo "WebKit WebContent PID(s):"
echo $WEBKIT_CONTENT_PID
@terry2010
terry2010 / index.html
Last active November 1, 2024 05:43
electron-mainWindow-capture
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<video style="display:none;" height="900"></video>
<canvas id="screenshot-canvas" style="display:none"></canvas>
<img id="screenshot-img" style="display:none"/>
</body>
@sindresorhus
sindresorhus / esm-package.md
Last active November 17, 2024 12:06
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@hotchpotch
hotchpotch / user_profile.ps1
Last active December 21, 2022 06:28
PowerShell Profile
# PS Modules
Import-Module posh-git
Import-Module oh-my-posh
Import-Module ZLocation
Set-Theme robbyrussell # お好きなテーマ
Set-PSReadLineOption -EditMode Emacs
@okanon
okanon / fuckin_nvidia.md
Last active November 20, 2022 08:16
グラボをNvidia Storeから個人輸入する際にハマった

グラボをNvidia Storeから個人輸入する際にハマった

結論

  • 無事購入できました:joy:
  • 代理店価格(日本価格)より1~2万円ほど安く購入できる
  • 初めて購入するときは結構沼るので注意が必要
  • 必ず在庫通知がメールに届くようにする
  • 万が一キャンセルされたときに、早く返金が欲しいならPaypal決済かつ銀行口座からの引き落としを使え

そんなところです

const val TAG_LENGTH = 16
class EncryptionOutput(val iv: ByteArray,
val tag: ByteArray,
val ciphertext: ByteArray)
fun encrypt(key: SecretKey, message: ByteArray): EncryptionOutput {
val cipher = Cipher.getInstance("AES/GCM/NoPadding")
cipher.init(Cipher.ENCRYPT_MODE, key)
val iv = cipher.iv.copyOf()
@hartator
hartator / dom-to-3d-view.js
Last active February 2, 2024 04:36
dom-to-3d-view.js
function domTo3DView(b, p) {
function l(k, c, b, e, g, d, f) {
return "<div style='position:absolute;-webkit-transform-origin: 0 0 0;" + ("background:" + f + ";") + ("width:" + e + "px; height:" + g + "px;") + ("-webkit-transform:" + ("translate3d(" + k + "px," + c + "px," + b + "px)") + ("rotateX(270deg) rotateY(" + d + "deg)") + ";") + "'></div>"
}
function o(k, c, d, f) {
for (var j = k.childNodes, n = j.length, m = 0; m < n; m++) {
var a = j[m];
if (1 === a.nodeType) {
a.style.overflow = "visible";
@rpalo
rpalo / walle.fish
Created June 23, 2018 18:01
Print a colored Wall-E in your terminal!
function walle
set light_blue C7E2E8
set gray C1C1BD
set light_gray EEE
set dark_gray 565653
set bronze C6973F
set yellow FFE500
set lime C6E80B
set brown 8C5D05
@twilson63
twilson63 / README.md
Created March 13, 2018 00:16
Pouchdb Server with MySQL Backend

PouchDB Server using a MySQL Backend

PouchDB server is a nodejs implementation of CouchDB. Below is the steps to use AmazonRDS and NowJS to deploy your own PouchDB Server. Using MySQL as a persistent backend.

Amazon Web Services

Create a Amazon Web Services Account

https://aws.amazon.com