Skip to content

Instantly share code, notes, and snippets.

# Add to your .gitconfig file, in the [alias] section.
graph = log --oneline --graph --decorate
md = machete discover
ms = machete status
mss = machete status --list-commits
mt = machete traverse --fetch --start-from=first-root
fetchtags = fetch --tags --force
showtags = log --tags --graph --oneline --decorate --simplify-by-decoration
git reflog --grep-reflog <pattern> # E.g. pattern can be a branch name
// From https://github.com/pmndrs/react-spring/blob/6b7d67210c4bf33d7cf3ceeda3d5803ba8dd6588/packages/shared/src/helpers.ts#L95
export const isSSR = () =>
typeof window === 'undefined' ||
!window.navigator ||
/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)
@stevejay
stevejay / d3-axis.js
Last active December 12, 2021 19:49
Commented version of the axis component from the d3.js library
// ----------------------------------------------------------------------------
//
// This is a commented version of the axis component from the d3.js library.
// I've also expanded some of the syntax to make it easier to read. The aim is
// to help people learning d3 to understand how this component works. It
// incorporates a few techniques that are worth knowing about.
//
// Original source code:
// https://github.com/d3/d3-axis/blob/64372b12c9ba5c8a816277b3ad04ff813db5af97/src/axis.js
// Documentation:
@stevejay
stevejay / vite-react-library.sh
Last active September 3, 2022 07:24
Script for scaffolding an app or library that is build using React + TypeScript + Vite + Vitest + Storybook + Playwright. The package manager used is Yarn Berry (non-PnP mode). The script has only been tested on macOS with the zsh shell. It was used to scaffold https://github.com/stevejay/ons-explorer
#!zsh
PACKAGE_MANAGER='yarn'
INSTALL_TAILWIND=true
# Run either with no args as an interactive script or with args for a non-interactive script.
HAS_ARGS=$([ ${#} -eq 0 ])
# Parse any command line args:
### Keybase proof
I hereby claim:
* I am stevejay on github.
* I am stevejay (https://keybase.io/stevejay) on keybase.
* I have a public key ASB8SYhOk16I_an50PxNaCz7vI-5Q59zf0eLhTugvRJkxAo
To claim this, I am signing this object:
@stevejay
stevejay / xstyled-system.d.ts
Last active May 27, 2021 05:23
TypeScript declaration file for @xstyled/system
// NOTE: This declaration file is now available on DefinitelyTyped: `npm install @types/xstyled__system`
// As a result, this gist is no longer being maintained.
/* eslint-disable @typescript-eslint/class-name-casing */
/* eslint-disable @typescript-eslint/no-explicit-any */
// Note: This is an early draft; there may be issues and a few typings use any.
// Acknowledgements:
// - The `styled-system` typings on DefinitelyTyped:
@stevejay
stevejay / structuremapjobfactory
Created July 18, 2014 16:10
StructureMapJobFactory for Quartz.Net
using System;
using System.Globalization;
using Common.Logging;
using Quartz;
using Quartz.Spi;
using StructureMap;
using LogManager = Common.Logging.LogManager;
namespace Scheduler
{
<system.web>
<!-- For IIS 6 -->
<httpHandlers>
<add path="*" verb="*"
type="NotFoundMvc.NotFoundHandler"/>
</httpHandlers>
</system.web>
...
<httpErrors errorMode="Custom">
<error statusCode="404" subStatusCode="-1"
path="/notfound" responseMode="ExecuteURL" />
</httpErrors>