Skip to content

Instantly share code, notes, and snippets.

@nrdobie
nrdobie / dev-server.js
Last active September 29, 2019 14:17
Node.js Server with webpack and auto reload
const { fork } = require('child_process');
const webpack = require('webpack');
const webpackServerConfig = require('./webpack.server.js');
let bundler = webpack(webpackServerConfig);
let child;
bundler.watch({}, (err, status) => {
@nrdobie
nrdobie / dom_benchmark.html
Last active August 23, 2016 22:35
document#createElement vs Node#cloneElement
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Benchmark</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.1/benchmark.min.js"></script>
<script>
@nrdobie
nrdobie / Drag-and-Drop.md
Last active December 22, 2020 19:50
Custom Leadbox Links

Drag & Drop Leadbox

Start with the Plain Text Link and copy the code from the box.

<script src="//static.leadpages.net/leadboxes/current/embed.js" async defer></script> <a href="" data-leadbox-popup="1410f2073f72a2:1165b2d55f46dc">Click here to subscribe</a> 

You'll need to include the script tag somewhere on your page. When creating the Leadbox link you can use any HTML element by adding the data-leadbox-popup attribute from the generated code, if you need to use an href on an <a> tag you can convert the data-leadbox-popup to an href by adding //{{YOUR LP SUBDOMAIN}}.leadpages.co/leadboxes/{{DATA ATTRIBUTE VALUE}}. For example data-leadbox-popup="1410f2073f72a2:1165b2d55f46dc" becomes href="//nickdobie.leadpages.co/leadboxes/1410f2073f72a2:1165b2d55f46dc".

@nrdobie
nrdobie / README.md
Last active May 5, 2024 18:08
Use CUID2 with Prisma

This will automatically use CUID2 for all id fields when creating elements in Prisma.

You'll need to add the following libraries to make this work

npm install --save @paralleldrive/cuid2 immer
yarn add @paralleldrive/cuid2 immer
pnpm add @paralleldrive/cuid2 immer