Skip to content

Instantly share code, notes, and snippets.

View macchiitaka's full-sized avatar
😁

macchiitaka macchiitaka

😁
View GitHub Profile
@macchiitaka
macchiitaka / object-fit.html
Last active May 3, 2023 13:22
[demo] object-fi
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>object-fit demo</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"
/>
<style>
@macchiitaka
macchiitaka / position-sticky.html
Last active May 3, 2023 13:32
[demo] position-stick
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>postion: stickey; demo</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"
/>
<style>
@macchiitaka
macchiitaka / string-to-array.js
Last active May 3, 2023 13:22
[demo] string to array
const foo = "foo";
// use Array.from
console.log("Array.from", Array.from(foo)); // [ 'f', 'o', 'o' ]
// use ES6 Array spread and Array.of function
console.log(Array.of(...foo)); // [ 'f', 'o', 'o' ]
// use ES6 Array spread and array literal
console.log([...foo]); // [ 'f', 'o', 'o' ]
@macchiitaka
macchiitaka / async-await.js
Last active May 3, 2023 13:21
[demo] async-await
const SEQUENCE = "sequence";
const PARALLEL = "parallel";
/**
* wait
*
* @param s
* @return {Promise}
*/
const wait = (s) => {
@macchiitaka
macchiitaka / deep-freeze.js
Last active May 3, 2023 13:21
[demo] deep freeze
/* if 'use strict' mode, TypeErrors occurs*/
/**
* freeze object deeply
*
* @param {{}} object
*/
const deepFreeze = (object) => {
Object.freeze(object);
- WebAssembly
- WASM
- WebAssembly の略
- WASI
- WebAssembly System Interface
- WebAssembly をウェブの外で使うためのシステムインターフェース
- \*.wat
- テキストファイル
- \*.wasm
- バイナリファイル
@macchiitaka
macchiitaka / dialog.tsx
Last active May 3, 2023 13:21
React Dialog component
import type { DialogHTMLAttributes } from "react";
import { forwardRef, useCallback, useEffect, useState } from "react";
declare global {
interface HTMLDialogElement {
show(): void;
showModal(): void;
close(): void;
}
}
@macchiitaka
macchiitaka / browser-gzip-csv-downloader-decompressor.js
Created July 3, 2024 10:58
A method to incrementally download large compressed files in a web browser while simultaneously decompressing and saving them to your computer.
// Add click event listener to a button
document.querySelector('button').addEventListener('click', async () => {
try {
const filename = 'sample.csv.gz';
// Open a file picker dialog and get a handle to the file
const fileHandle = await window.showSaveFilePicker({
suggestedName: filename.slice(0, -'.csv.gz'.length), // Remove .csv.gz extension
types: [
{
@macchiitaka
macchiitaka / index.html
Created July 13, 2024 08:55
@starting-style sample
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>@starting-style</title>
<style>
body,
h1 {
margin: 0;
}