Skip to content

Instantly share code, notes, and snippets.

@FND
FND / .gitignore
Created July 21, 2020 12:43
faucet-typescript sample
/node_modules
/package-lock.json
/dist
@FND
FND / .gitignore
Last active May 30, 2020 09:10
bundling jQuery plugins with faucet-pipeline
/node_modules
/package-lock.json
/dist
@FND
FND / README.md
Created April 21, 2020 18:56
static vs. dynamic ESM imports
$ mkdir -p node_modules/my-lib
$ cp package.json node_modules/my-lib/
$ mv my_lib.js node_modules/my-lib/index.js

$ node index_static.js
$ node index_dynamic.js
@FND
FND / .gitignore
Last active March 18, 2020 05:52
JavaScript in Ruby
/vendor
@FND
FND / .gitignore
Last active February 6, 2020 06:56
minimal complate sample
/node_modules
/dist
@FND
FND / README.md
Last active January 15, 2020 16:55
test case for resolving implicit package names

test case for resolving implicit package names

  1. npm install

  2. ./test should emit something like the following:

    project directory: /home/dev
    moving to /tmp
    

resolved: /tmp/node_modules/material-design-icons/index.js

@FND
FND / ast_manipulation.js
Last active September 16, 2019 13:19
JavaScript AST manipulation
#!/usr/bin/env node
let { generate } = require("escodegen");
let jsx = require("acorn-jsx");
let acorn = require("acorn");
let { strictEqual: assertSame } = require("assert");
let JSXParser = acorn.Parser.extend(jsx());
let ast = JSXParser.parse(`<Card title={123}>
@FND
FND / README.md
Last active September 16, 2019 06:32
(De-)Serializing JavaScript Models With Metaprogramming

compare before.js with after.js

@FND
FND / sample.js
Created September 16, 2019 04:47
complate promises
// render view
let tree = frontpage({
title: "My Site",
groups: ["AAA", "BBB"]
});
console.log("ready to render", tree);
// views
function frontpage({ title, groups }) {
@FND
FND / index.html
Last active September 13, 2019 07:04
basic Service Worker sample
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My Static Site</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>