Skip to content

Instantly share code, notes, and snippets.

@t-cool
t-cool / idb-backup-and-restore.md
Created August 15, 2024 09:49 — forked from loilo/idb-backup-and-restore.js
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@t-cool
t-cool / php_form_submit.md
Last active February 21, 2022 11:54 — forked from jesperorb/php_form_submit.md
PHP form submitting with fetch + async/await

PHP Form submitting

アプリケーションに以下のような構造があるとします。

  • 📁 application_folder_name
    • 📄 index.php
    • 📄 handle_form.php
    • 📄 main.js

そして、フォームを備えた基本的なウェブサイトを動作させるために、index.php に以下の内容を記述します。これは、お好みのphpサーバーで実行できるはずです。

@t-cool
t-cool / mixin.dart
Created November 8, 2021 03:14
Dart Mixin
// クラスの継承関係でうまくいかないとき Mixin で継承をする
mixin M {
int intM = 111;
String methodM() => "M's method";
}
mixin N {
int intN = 111;
String methodN() => "N's method";
@t-cool
t-cool / main.dart
Last active October 19, 2021 05:15
import 'dart:math';
void main() {
print('--データ型--');
num n1 = pow(2, 63);
int n2 = 2;
double n3 = 1.23;
bool b1 = true;
String s1 = "string";
@t-cool
t-cool / shiguredo_tech.rst
Created March 7, 2020 09:39 — forked from voluntas/shiguredo_tech.rst
時雨堂を支える技術

時雨堂を支える技術

日時:2019-09-26
作:時雨堂
バージョン:19.09.0
URL:https://shiguredo.jp/

言語

@t-cool
t-cool / shiguredo_tech.rst
Created March 7, 2020 09:39 — forked from voluntas/shiguredo_tech.rst
時雨堂を支える技術

時雨堂を支える技術

日時:2019-09-26
作:時雨堂
バージョン:19.09.0
URL:https://shiguredo.jp/

言語

@t-cool
t-cool / styled-components-howtouse.md
Created January 29, 2020 03:56 — forked from kenmori/styled-components-howtouse.md
styled-componentsの使い方(パッとわかりやすく、色々なパターンを説明することを目指しています)

styled-componentsの使い方(パッとわかりやすく、色々なパターンを説明することを目指す記事)

styled-compoents

本家ドキュメント

こちらはStyled-componentsの使い方、ユースケースを集めた端的なページです。
なにかの問題解決、参考になりましたらスターを押してくださいませ。励みになります。
@t-cool
t-cool / article.md
Created September 1, 2018 02:04 — forked from y2q-actionman/a_road_to_common_lisp_jp.md
A Road to Common Lisp ほんやく
(ql:quickload :parenscript)
(ql:quickload :cl-who)
(ql:quickload :clack)
(in-package :ps)
(defvar *canvas-id* "alien-canvas")
(clack:clackup
(lambda (env)
(list 200
'(:content-type "text/html")
(list
@t-cool
t-cool / aobench.lisp
Created June 18, 2017 14:19 — forked from youz/aobench.lisp
aobench CommonLisp ver.
(defparameter image-width 256)
(defparameter image-height 256)
(defparameter nsubsamples 2)
(defparameter nao-samples 8)
;; vector
(defmacro vx (v) `(svref ,v 0))
(defmacro vy (v) `(svref ,v 1))
(defmacro vz (v) `(svref ,v 2))