Skip to content

Instantly share code, notes, and snippets.

@daichan4649
daichan4649 / line.ts
Created July 23, 2023 12:38
Nuxt3 (Express) + LINE Messaging API
// server_express/api/line.ts
import { ClientConfig, Client, middleware, MiddlewareConfig, WebhookEvent, TextMessage, } from '@line/bot-sdk'
const channelAccessToken = process.env.CHANNEL_ACCESS_TOKEN || ''
const channelSecret = process.env.CHANNEL_SECRET || ''
const clientConfig: ClientConfig = {
channelAccessToken,
channelSecret,
}
const middlewareConfig: MiddlewareConfig = {
channelAccessToken,
@daichan4649
daichan4649 / main.js
Last active January 6, 2023 03:03
[GAS] register to Google Calendar from SpreadSheet #spreadsheet #calendar #google
const URL_BOOK = 'Spread Sheet URL (public)';
const SHEETNAME = 'Sheet Name';
const CALENDAR_ID = 'xxxxx@group.calendar.google.com';
function main() {
register2Calendar();
}
function register2Calendar() {
// create JSON (from SpreadSheet)
@daichan4649
daichan4649 / config.service.ts
Last active October 28, 2022 14:03
Bot2Notion
import { Injectable } from '@nestjs/common';
import { ConfigService as NestConfigService } from '@nestjs/config';
// Notion
import { Client as NotionClient } from '@notionhq/client';
@Injectable()
export class ConfigService {
private readonly config = this.createConfig();
@daichan4649
daichan4649 / auth.js
Last active May 10, 2022 02:26
Nuxt.js + Firebase Authentication (with FirebaseUI)
// middleware/auth.js
export default async ({ store, redirect }) => {
const loggedIn = await store.dispatch('isLoggedIn')
if (!loggedIn) {
redirect('/login')
}
}
@daichan4649
daichan4649 / CrosshairForm.cs
Created September 6, 2021 05:21
[Windows Form] show overlay crosshair
using System.Drawing;
using System.Windows.Forms;
namespace crosshair
{
class CrosshairForm : Form
{
public CrosshairForm()
{
// Form 設定

#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に感謝したいと思う

@daichan4649
daichan4649 / 01_google.js
Last active April 18, 2018 05:11
[GAS] create short url (google, bitly)
// Google URL Shortener
// https://developers.google.com/url-shortener/v1/getting_started
function createGoogleShortUrl(url) {
var result = UrlShortener.Url.insert({
longUrl: url
});
return result.id;
}
@daichan4649
daichan4649 / メイン画面(現在).xml
Last active September 6, 2017 01:53
メイン画面のレイアウト
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="daichan4649.jazzspotfukuoka.view.activity.MainActivity">
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@daichan4649
daichan4649 / main.gs
Created June 27, 2017 00:02
scrape subway status
var URL_SUBWAY = "http://subway.city.fukuoka.lg.jp/status/";
var REGEXP_STATUS = /<div class=\"statusNews\">(.*)<\/div>/gi;
function doGet() {
var status = scrapeSubwayStatus();
Logger.log(status);
var json = {};
json['status'] = status;
json['url'] = URL_SUBWAY;