Skip to content

Instantly share code, notes, and snippets.

View nandanmen's full-sized avatar

Nanda Syahrasyad nandanmen

View GitHub Profile
import "server-only";
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import * as t from "@babel/types";
import { generate } from "@babel/generator";
const SNAPSHOT = "__snapshots";
export function parseAlgorithm(code: string) {
const ast = parse(code);
/**
* This is what the script outputs given the following two files:
* - content/tokenizer/Tokenizer/Tokenizer.stories.tsx
* - content/framer-magic-motion/LayoutExample/LayoutExample.stories.tsx
*/
import * as LayoutExample from '../_dist-content/framer-magic-motion/components/LayoutExample/LayoutExample.stories'
import * as Tokenizer from '../_dist-content/tokenizer/components/Tokenizer/Tokenizer.stories'
const stories = [
{ name: 'LayoutExample', variants: LayoutExample, postName: 'framer-magic-motion' },
@nandanmen
nandanmen / asynchronous-user-event.md
Last active August 4, 2022 20:06
A look at some of the implications of making `userEvent` calls asynchronous.

Asynchronous userEvent

One of the breaking changes of userEvent in v14 is the change to asynchronous user events:

userEvent.click() // <-- returns a Promise!

This sounds like a pretty small change, but let's take a look at some of the implications.

Consider this Counter component:

class Wallet
def initialize
@money = 0
end
def add_money!(amount:)
@money += amount
end
def purchase!(amount:)
@nandanmen
nandanmen / firebase-demo.html
Created January 31, 2021 21:59
Lightweight firebase demo (no frameworks)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div>
<h1>Counter</h1>
@nandanmen
nandanmen / tyde-cos.md
Created December 22, 2020 21:42
TYDE Circle of Support

CircleOfSupport

The CircleOfSupport acitivity is a TYDE activity that allows users to manage their closest connections and group them into communities.

Its data is split into three major pieces — connections, communities, and circles:

interface CircleOfSupport {
  id: string
  connections: Connection[]
git checkout tyde
git pull
git checkout -b <tyde-feature-branch>
git cherry-pick <first-commmit-of-feature-branch>
git cherry-pick `git rev-list --reverse --no-merges --first-parent <first-commmit-of-feature-branch>..<feature-branch>`
yarn add -D eslint eslint-config-prettier eslint-plugin-prettier prettier
touch .eslintrc
echo '{
"extends": [
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2019
@nandanmen
nandanmen / test-checklist.md
Created November 19, 2019 00:00
Checklist for manual integration testing for Tapestry project.

Test Checklist

Basic Tests

Operations

  • Should add root node

    • (BUG) My bug that I see when I try to perform the above test
@nandanmen
nandanmen / linter.sh
Last active October 10, 2019 20:07
Bash script to add linter and config
npm install --save-dev babel-eslint eslint eslint-config-prettier eslint-loader eslint-plugin-prettier eslint-plugin-vue
mkdir .vscode
touch .vscode/settings.json
touch .vscode/extensions.json
echo '{
"recommendations": ["octref.vetur", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}' > .vscode/extensions.json