Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥

Andrew Sullivan sllvn

🔥
View GitHub Profile
@kjmph
kjmph / UUID_v7_for_Postgres.sql
Last active Aug 11, 2022
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well.
View UUID_v7_for_Postgres.sql
create extension if not exists pgcrypto;
create or replace function uuid_generate_v7()
returns uuid
as $$
declare
ver_rand_var bytea = e'\\000\\000\\000';
unix_time_ms bytea;
rand_bytes bytea;
begin
View storybook-webpack5-experimental.md

⚠️ Warning: this document is out of date.

For the most recent webpack5 instructions see MIGRATION.md.

Storybook experimental Webpack 5 support

Storybook 6.2 includes experimental Webpack 5 support. Webpack 5 brings a variety of performance improvements, as well as exciting new features like module federation. Here's a quick guide to get you going.

Intro

@IanColdwater
IanColdwater / twittermute.txt
Last active Aug 12, 2022
Here are some terms to mute on Twitter to clean your timeline up a bit.
View twittermute.txt
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@erquhart
erquhart / selection-command.js
Last active May 25, 2022
Text selection commands for Cypress.io
View selection-command.js
/**
* Credits
* @Bkucera: https://github.com/cypress-io/cypress/issues/2839#issuecomment-447012818
* @Phrogz: https://stackoverflow.com/a/10730777/1556245
*
* Usage
* ```
* // Types "foo" and then selects "fo"
* cy.get('input')
* .type('foo')
@JMPerez
JMPerez / service-worker.js
Created Oct 27, 2018
An example of a service worker for serving network first, cache second
View service-worker.js
// the cache version gets updated every time there is a new deployment
const CACHE_VERSION = 10;
const CURRENT_CACHE = `main-${CACHE_VERSION}`;
// these are the routes we are going to cache for offline support
const cacheFiles = ['/', '/about-me/', '/projects/', '/offline/'];
// on activation we clean up the previously registered service workers
self.addEventListener('activate', evt =>
evt.waitUntil(
@hjr3
hjr3 / dc_2017_biblio.md
Last active Nov 16, 2017 — forked from BaseCase/dc_2017_biblio.md
List of resources recommended or mentioned by the speakers at Deconstruct 2017
View dc_2017_biblio.md

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
@BaseCase
BaseCase / dc_2017_biblio.md
Last active Jan 23, 2020
List of resources recommended or mentioned by the speakers at Deconstruct 2017
View dc_2017_biblio.md

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
View 0-bridging-react-native-cheatsheet.md
@acdlite
acdlite / app.js
Last active Jul 19, 2022
Quick and dirty code splitting with React Router v4
View app.js
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.