最低限のコンポーネントを並べると他のライブラリとあまり変わらないです。 ただレイヤーを意識して実装してみると、他のライブラリのチュートリアル通りの実装比較では実装量が増えると思います。 ただし、その場合も増えているのはAlminに依存した部分ではなく、自分で実装しないといけないDomainやInfra(Repository)などといったレイヤーになります。 これは責務をレイヤーで分離する考え方から来ているので、他のライブラリでも同じようなレイヤーを実装すると同じようにコード量が増えると思います。(登場人物が多く見える)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Location } from "@reach/router"; | |
let scrollPositions = {}; | |
class ManageScrollImpl extends React.Component { | |
componentDidMount() { | |
try { | |
// session storage will throw for a few reasons | |
// - user settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting, | |
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that | |
// fires on insert which auto-generates the tsvector field for each newly inserted entry. | |
// This is an example knex migration file for said behavior. | |
const addUserIndex = ` | |
ALTER TABLE public.user ADD "document" tsvector; | |
CREATE FUNCTION my_trigger_function() | |
RETURNS trigger AS $$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini | |
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V | |
#include <GxEPD.h> | |
// select the display class to use, only one | |
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp> // 1.54" b/w/r 200x200 | |
#include GxEPD_BitmapExamples | |
// FreeFonts from Adafruit_GFX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAllClassMethods = (obj) => { | |
let keys = [] | |
let topObject = obj | |
const onlyOriginalMethods = (p, i, arr) => | |
typeof topObject[p] === 'function' && // only the methods | |
p !== 'constructor' && // not the constructor | |
(i === 0 || p !== arr[i - 1]) && // not overriding in this prototype | |
keys.indexOf(p) === -1 // not overridden in a child |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable Docker for your repository | |
options: | |
docker: true | |
pipelines: | |
branches: | |
development: | |
- step: | |
# python image with aws-cli installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await Puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto('https://example.com'); | |
const header = await page.$('h1'); | |
const rect = await page.evaluate((header) => { | |
const {top, left, bottom, right} = header.getBoundingClientRect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import org.w3c.dom.HTMLElement | |
@JsName("grecaptcha") | |
external object GoogleRecaptcha { | |
fun render(element: HTMLElement, options: RecaptchaOptions) | |
} | |
class RecaptchaOptions(val sitekey: String, val callback: String, val size: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>WebSocket demo</title> | |
</head> | |
<body> | |
<script> | |
var ws = new WebSocket("ws://127.0.0.1:8765/"), | |
messages = document.createElement('ul'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name your.domain.com; | |
location = /analytics.js { | |
# you have to compile nginx with http://nginx.org/en/docs/http/ngx_http_sub_module.html (this is not default) | |
# and http://nginx.org/en/docs/http/ngx_http_proxy_module.html (it's a default module) | |
proxy_set_header Accept-Encoding ""; |