Refactor of https://gist.github.com/tadast/9932075#gistcomment-2283895
$ mkdir config/certs && touch config/certs/.keep
# .gitignore
/config/certs/*
const title = (document.querySelector("#productTitle") || document.querySelector("#ebooksProductTitle")).innerText; | |
let body = '[amazon ' + window.location.href + ']\n'; | |
const orderContainer = (document.querySelector("#instantOrderUpdate") || document.querySelector("#ebooksInstantOrderUpdate")); | |
if (orderContainer) { | |
const year = new RegExp(/\d{4}/).exec(orderContainer.innerText)[0]; | |
const year_month = new RegExp(/\d{4}\/\d{1,2}/).exec(orderContainer.innerText)[0]; | |
body = body + 'Ordered: [' + year + '], [' + year_month + ']\n'; | |
} |
Refactor of https://gist.github.com/tadast/9932075#gistcomment-2283895
$ mkdir config/certs && touch config/certs/.keep
# .gitignore
/config/certs/*
#!/bin/sh | |
# Required: hub, jq | |
commit=$1 | |
pr=$(hub api graphql -F query=" | |
{ | |
repository(name: \"{repo}\", owner: \"{owner}\") { | |
commit: object(expression: \"$commit\") { | |
... on Commit { |
version: "3" | |
services: | |
db: | |
image: mysql:5.7 | |
container_name: sample-db | |
ports: | |
- 3344:3306 | |
volumes: | |
- ./db/mysql:/var/lib/mysql |
/** @type import("eslint").Linter.Config */ | |
module.exports = { | |
env: { browser: true, node: true }, | |
parser: '@typescript-eslint/parser', | |
extends: [ | |
"eslint:recommended", | |
"plugin:@typescript-eslint/recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"plugin:react/recommended", |
document.createElement("canvas") | |
.getContext("2d") | |
.measureText("Hello こんにちは 😀") | |
.width; |
import { | |
NumberDecrementStepper, | |
NumberIncrementStepper, | |
NumberInput, | |
NumberInputField, | |
NumberInputStepper, | |
} from "@chakra-ui/react"; | |
import { Controller } from "react-hook-form"; | |
<Controller |
import { Route, Switch } from "wouter-preact"; | |
const pageFiles = import.meta.globEager("./pages/**/*.tsx"); | |
const pages = Object.keys(pageFiles) | |
.sort() | |
.reverse() // Ensure the order of page file names. Put `:<filename>` to the end of the array. | |
.map((filePath) => { | |
const path = filePath.slice(8, -4).replace(/\/?index$/, ""); | |
const { Page } = pageFiles[filePath]; |
class Page | |
DEFAULT_PAGE_SIZE = 20 | |
def initialize(all_nodes, page:, per_page:) | |
@all_nodes = all_nodes | |
# Normalize pagination arguments | |
@page = if page.nil? || page < 1 | |
1 | |
else | |
page |
# official docs: https://graphql-ruby.org/dataloader/sources.html | |
# app/graphql/sources/association.rb | |
class Sources::Association < ::GraphQL::Dataloader::Source | |
def initialize(association_name, scope = nil) | |
@association_name = association_name | |
@scope = scope | |
end | |
def fetch(records) |