Skip to content

Instantly share code, notes, and snippets.

View hanachan1026's full-sized avatar
🎯
Focusing

Takuma hanachan1026

🎯
Focusing
View GitHub Profile
@hanachan1026
hanachan1026 / example.ts
Created March 6, 2023 12:51
zod-domain-modeling-made-functional
const String50 = z.string().min(1).max(50).brand("String50")
type String50 = z.infer<typeof String50>
String50.parse("") // Parse Error
String50.parse("Hello") // String50 of "Hello"
@hanachan1026
hanachan1026 / doPost.js
Created February 21, 2023 08:28
GAS周り
function doPost(e) {
// エクステンションから送信されたデータを取り出す
const params = JSON.parse(e.postData.getDataAsString());
const title = params.title;
const url = params.url;
// スプレッドシートの最終行に書き出す
const sheet = SpreadsheetApp.openById('xxxxxxxxxxxxxxx').getSheetByName("xxxxx");
sheet.appendRow([title, url]);
@hanachan1026
hanachan1026 / titleUrlMarkdownClip.js
Created November 5, 2022 10:21 — forked from idelem/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@hanachan1026
hanachan1026 / render-youglish.cljs
Created October 24, 2022 00:15 — forked from KarimAziev/render-youglish.cljs
ClojureScript to render YouGlish in Roam
(ns youglish
(:require [roam.datascript.reactive :as dr]
[roam.block :as block]))
;; utils
(defn get-parent-string
"Gets the string of the immediate parent block"
[block-uid]
(->> @(dr/pull '[{:block/_children [:block/string]}]
@hanachan1026
hanachan1026 / file0.txt
Created October 20, 2022 03:29 — forked from unoemon/file0.txt
Linuxでディスク容量はあるのに容量不足エラーが出る場合の対処法 ref: http://qiita.com/unoemon/items/03a49f303176ad8e4035
# ls -ld /tmp
dr-xr-xr-x. 11 root root 4096 Aug 21 04:08 /tmp
type PasswordScoreProps = {
name: keyof Form;
control: Control<Form>;
children: (score: ZXCVBNScore) => ReactNode;
};
function PasswordScore({ name, control, children }: PasswordScoreProps) {
const password = useWatch({ name, control });
const score = zxcvbn(password).score; // 算出されたスコアを取得
const childNode = useMemo(() => children(score), [children, score]);
// メモ化し、スコア変更時にだけ、子コンポーネント再描画
@hanachan1026
hanachan1026 / Web周り.md
Last active February 10, 2023 13:48
ソフトウェア開発
@hanachan1026
hanachan1026 / ExecutesCommand.php
Created October 1, 2021 07:39
PHP execute on background trait
// laravel artisan usage
// $cmd = "php " . base_path() . "/artisan calculate_bill:invoice_csv_send_email";
<?php
namespace App\Traits; // FIXME your namespace
trait ExecutesCommand
{
private static function executeOnAnotherProcessSync($cmd, array $args = []): void

#NoSQLデータモデリング技法

原文:NoSQL Data Modeling Techniques « Highly Scalable Blog

I translated this article for study. contact matope[dot]ono[gmail] if any problem.

NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。

本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う

<?php
echo "Hello world!";