Skip to content

Instantly share code, notes, and snippets.

View Quramy's full-sized avatar
👾

Yosuke Kurami Quramy

👾
View GitHub Profile
@Quramy
Quramy / run.sh
Created August 30, 2024 05:56
Amplify run.sh
#!/bin/bash
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_SESSION_TOKEN
mkdir -p '/tmp/app/.next/server/pages'
echo '[x-amplify-log][INFO] starting copy'
cp -r '/var/task/.next/server/pages' '/tmp/app/.next/server'
echo '[x-amplify-log][INFO] copy server pages complete'
cp -f /var/task/server.js /tmp/app/server.js
echo '[x-amplify-log][INFO] copy complete'
@Quramy
Quramy / README.md
Created February 2, 2024 01:42
Next.js の Experimental Test Mode は何をしているのか

先週に同僚と会話していたときに気になっていた Experimental Test Proxy について。

https://github.com/vercel/next.js/blob/canary/packages/next/src/experimental/testmode/playwright/README.md

mugi さんの素振りメモこの機能が実装された際の PR のコードを読んで、ようやく何が行われているかを理解した。

まず、README にある以下のコードがどこをスタブしているかであるが、

import { test, expect } from "next/experimental/testmode/playwright";
@Quramy
Quramy / index.tsx
Last active April 11, 2024 15:34
Analogy RSC and GraphQL resolver
import { cache } from "react";
import DataLoader from "dataloader";
// backend service clients
import { getPopularPosts, getUserById, getUsers } from "@/services";
const memoizedGetUserById = cache(getUserById);
const getUserLoader = () =>
@Quramy
Quramy / README.md
Created August 3, 2022 08:49
Thinking GraphQL Client cache
@Quramy
Quramy / index.ts
Created June 16, 2021 05:03
Remove unused GraphQL fragment
import assert from "assert";
import { parse, print, DocumentNode, visit } from "graphql";
function removeUnusedFragment(document: DocumentNode) {
const usedFragmentSet = new Set<string>();
// mark used
visit(document, {
FragmentSpread(node) {
usedFragmentSet.add(node.name.value);
@Quramy
Quramy / README.md
Last active March 4, 2021 02:45
TS 4.2
@Quramy
Quramy / mini_calc_interpreter.ts
Last active September 2, 2020 01:03
Mini calc compiler with TS template string types
/**
*
* Mini calc with TypeScript template string types
*
* EBNF
*
* ```
* expr = mul ("+" mul)*
* mul = primary ("*" primary)*
* primary = num | "(" expr ")"
import { Rule } from "eslint";
const rule: Rule.RuleModule = {
create: (context) => {
return {
['NewExpression:not(:has(*.arguments)) > Identifier[name="Date"], CallExpression > MemberExpression:has(Identifier.object[name="Date"]) > Identifier.property[name="now"]']: (node: any) => {
context.report({
message: "Don't use side-effective Date function.",
node,
});