CrUX is the Chrome UX Report from Google. This crash course will take you through everything you need to get the most out of the data.
https://developers.google.com/web/tools/chrome-user-experience-report/
| ### Find & Replace | |
| ## basic examples | |
| # replaces "urchin" with "analytics" in all files in current directory and backs up originals as .bak files | |
| find . -type f -exec sed -i.bak "s/urchin.js/analytics.js/g" {} \; | |
| # reverses the prior command, restoring all the original (now .bak) files | |
| find . -name "*.bak" -exec sh -c 'mv -f $0 ${0%.bak}' {} \; |
| /** | |
| * @desc Basic linear value animation that can accept simple easing functions and provides update & complete callbacks | |
| * @param {Object} values - Object with numerical values. eg. { value1: 0, value2: 20, someKey: 55 } | |
| * @param {Number} duration - How long (in milliseconds) the animation will be | |
| * @param {Object} options - target values, update callback & complete callback | |
| * @param {Function} [options.onComplete=(values) => values] - Callback that fires once animation is complete | |
| * @param {Function} [options.onUpdate=(values) => values] - Callback that fires when animation frame updates | |
| * @param {Function} [options.ease=(t) => t] - easing method eg. https://gist.github.com/gre/1650294 | |
| * @example | |
| * |
| var trimCanvas = (function() { | |
| function rowBlank(imageData, width, y) { | |
| for (var x = 0; x < width; ++x) { | |
| if (imageData.data[y * width * 4 + x * 4 + 3] !== 0) return false; | |
| } | |
| return true; | |
| } | |
| function columnBlank(imageData, width, x, top, bottom) { | |
| for (var y = top; y < bottom; ++y) { |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Asynchronous Sentry JavaScript Error Tracking</title> | |
| <!-- putting your CSS near the top is always a good idea --> | |
| <link rel="stylesheet" href="/app.css"></link> |
| function (user, context, callback) { | |
| user.app_metadata = user.app_metadata || {}; | |
| if ('stripe_customer_id' in user.app_metadata) { | |
| context.idToken['https://example.com/stripe_customer_id'] = user.app_metadata.stripe_customer_id; | |
| return callback(null, user, context); | |
| } | |
| var stripe = require('stripe')('sk_....'); | |
| var customer = { |
CrUX is the Chrome UX Report from Google. This crash course will take you through everything you need to get the most out of the data.
https://developers.google.com/web/tools/chrome-user-experience-report/
| import ErrorStackParser from 'error-stack-parser' | |
| const ROLLBAR_ACCESS_TOKEN = '[ACCESS TOKEN]' | |
| var rollbarUrl = `https://api.rollbar.com/api/1/item/` | |
| // https://github.com/rollbar/rollbar.js/blob/master/src/errorParser.js | |
| function Frame(stackFrame: ErrorStackParser.StackFrame) { | |
| var data:any = {}; | |
| // data._stackFrame = stackFrame; |
This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).
Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.
When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.
| import { z } from 'zod' | |
| /** | |
| * @summary Function returns default object from Zod schema | |
| * @version 23.05.15.2 | |
| * @link https://gist.github.com/TonyGravagno/2b744ceb99e415c4b53e8b35b309c29c | |
| * @author Jacob Weisenburger, Josh Andromidas, Thomas Moiluiavon, Tony Gravagno | |
| * @param schema z.object schema definition | |
| * @param options Optional object, see Example for details | |
| * @returns Object of type schema with defaults for all fields |