Skip to content

Instantly share code, notes, and snippets.

View takeshiyu's full-sized avatar
🌏

YU WU HSIEN takeshiyu

🌏
View GitHub Profile
@takeshiyu
takeshiyu / usb-connected-hand-held-barcode-scanner-input.js
Created August 12, 2023 15:41 — forked from neelbhanushali/usb-connected-hand-held-barcode-scanner-input.js
Javascript for detecting usb connected - hand held - barcode scanner input
// Author: Neel Bhanushali <neal.bhanushali@gmail.com>
document.addEventListener('keydown', function(e) {
// add scan property to window if it does not exist
if(!window.hasOwnProperty('scan')) {
window.scan = []
}
// if key stroke appears after 10 ms, empty scan array
if(window.scan.length > 0 && (e.timeStamp - window.scan.slice(-1)[0].timeStamp) > 10) {
window.scan = []
@takeshiyu
takeshiyu / tenant-middleware.php
Created December 1, 2021 13:57 — forked from taylorotwell/tenant-middleware
Magical tenant middleware thing
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Auth\Access\AuthorizationException;
class VerifyTenants
{
/**
@takeshiyu
takeshiyu / rust-vs-go.md
Created March 10, 2021 03:06 — forked from weihanglo/rust-vs-go.md
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio MerinoRust vs. Go。Julio Merino 目前是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!