Author: @jenseng
The FormData
class allows developers to create data sets populated from a <form>
element, following the same algorithm used during regular form submission.
Author: @jenseng
The FormData
class allows developers to create data sets populated from a <form>
element, following the same algorithm used during regular form submission.
import fs from "fs/promises"; | |
import url from "url"; | |
import vm from "vm"; | |
/** | |
* Import a single module without caching it; if you call this function again the module will be re-imported | |
* | |
* Moderately leaky workaround for https://github.com/nodejs/modules/issues/307 | |
* | |
* Note: |
Here's the basic process I followed for implementing the "Show Route Components" feature in the demo apps I showed in my Remix conf talk.
Someone could probably generalize/improve this further and make it into a drop-in library :)
See the files below for the specifics, but here's the TL;DR:
[data-filepath]
look how you wantdata-filepath={__filename}
YMMV, but this worked for me to get Remix working on Node 12. I'm using Restify, but this is really just Node 12 polyfill stuff so it should work with other servers/adapters:
fs.promises
as a dependencypromises-polyfill.js
with the following:
// this polyfills promise stuff for `fs` and even makes `require('fs/promises')` work
require('fs.promises');
// we also need to polyfill `Promise.all` for remix
//... | |
export default function App() { | |
let location = useLocation(); | |
React.useLayoutEffect(() => { | |
[...document.querySelectorAll<HTMLSpanElement>('pre[data-lang] span')] | |
.filter(el => ['let', 'const', 'var'].includes(el.innerText)) | |
.forEach(el => el.innerText = ['let', 'const', 'var'][Math.floor(Math.random() * 3)]); | |
}, [location.pathname]); |
# a query that finds all IDENTITY columns and then outputs | |
# queries that find the max value for each table and then output | |
# an appropriate alter table call for each one | |
# which we then run 3x through psql 😅🤯 | |
# | |
# this assumes you have appropriate PG* variables set up, e.g. | |
# PGDATABASE=mydb | |
# PGHOST=localhost | |
# ... | |
cat<<EOF|psql -t -A|psql -t -A|psql -q |
#!/usr/bin/env ruby | |
# This demonstrates a race condition in simplecov:HEAD that occurs when you | |
# have several processes merging results at the same time (e.g. test-queue, | |
# parallel_test). The bug manifests itself as either missing coverage, or | |
# outright failures. | |
# | |
# Usage: | |
# ruby dumb_test.rb | |
# |
Name | Time |
---|---|
Dallas DeVries | 22:31 |
Jon Jensen | 23:05 |
David White | 23:54 |
Bob Hanson | 24:11 |
Joel Duffin | 26:28 |
Aaron Patterson | 26:28 |
Phin Jensen | 26:50 |
Jeremy Stanley | 27:23 |
#!/usr/bin/env ruby | |
begin | |
require "ya2yaml" | |
rescue | |
`gem install ya2yaml` | |
require "ya2yaml" | |
end | |
begin |
Name | Time |
---|---|
Paul Hoffer | 21:00.40 |
Dallas DeVries | 21:52.58 |
??? | 22:14.86 |
Jon Jensen | 22:35.07 |
Lauren Williams | 23:07.99 |
Kent Besaw | 23:35.69 |
Landon Wilkins | 24:15.08 |
Jordan Dayton | 25:11.76 |