Skip to content

Instantly share code, notes, and snippets.

@marr
marr / launch.json
Created March 5, 2023 14:10
Fullstack Debugging nuxt@2 with VS Code
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "client: chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"userDataDir": false,
@marr
marr / repro.mjs
Last active February 10, 2023 02:59
import { ofetch } from "../dist/node.mjs";
let body;
body = { x: 1 }; // request body is "[object Object]"
// body = JSON.stringify(body); // request body is correctly received
const url ='https://d0348819-d0b4-4913-b739-360dfe6e0eef.mock.pstmn.io/debug';
const response = await ofetch(url, { body, method: "PATCH" });
console.log(response);
<template>
<div>
<label class="block text-sm font-medium text-gray-700" :for="name">{{
label
}}</label>
<div class="mt-1 rounded-md shadow-sm">
<input
:class="classes"
:id="id || name"
:name="name"
@marr
marr / machine.js
Last active January 24, 2022 18:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
function fetchWithTimeout( url, timeout ) {
return new Promise( (resolve, reject) => {
// Set timeout timer
let timer = setTimeout(
() => reject( new Error('Request timed out') ),
timeout
);
fetch( url ).then(
response => resolve( response ),
const controller = new AbortController()
const signal = controller.signal
setTimeout(() => {
controller.abort()
}, 1000)
fetch(url, { signal })
@marr
marr / .js
Last active June 12, 2019 14:14
gainResult(fn) {
return Promise.race([
new Promise(resolve => {
try {
const ret = fn((err, result) => {
if (err) {
resolve({
type: "async",
error: err.message
});
#!/bin/bash
cd dist
shopt -s nullglob
for f in *.map
do
echo "uploading $f to New Relic"
publish-sourcemap $f $SCHUMACHER_CLIENT_ROOT --applicationId=238312787 --nrAdminKey=$NEW_RELIC_ADMIN_KEY
done
cd -
{
"version": 2,
"name": "phmt.me",
"builds": [
{ "src": "package.json", "use": "@now/static-build", "config": { "distDir": "build" } }
],
"routes": [
{ "src": "/static/(.*)", "headers": { "cache-control": "s-maxage=31536000,immutable" }, "dest": "/static/$1" },
{ "src": "/favicon.ico", "dest": "/favicon.ico" },
{ "src": "/asset-manifest.json", "dest": "/asset-manifest.json" },
diff --git c/src/ui/form/InputField.css i/src/ui/form/InputField.css
index 088fbc98..7946478e 100644
--- c/src/ui/form/InputField.css
+++ i/src/ui/form/InputField.css
@@ -4,13 +4,24 @@
width: 100%;
}
-.inputField-input[type="text"] {
+.inputField-input[type="text"],