Skip to content

Instantly share code, notes, and snippets.

@martin-fv
martin-fv / PostList.stories.tsx
Last active April 5, 2024 19:41
Storybook mocking and Supertest with tRPC v10
import { Meta } from "@storybook/react/types-6-0";
import { PostList } from "../PostList";
import { getTRPCMock } from "../getTrpcMock";
export default {
title: "Components/PostList",
component: PostList,
} as Meta;
export const PostListPage = () => {
@ahorn42
ahorn42 / Share-PartialScreen.ps1
Last active August 31, 2023 07:14
A small powershell script to allow to record and play back a part of your screen with VLC to allow partial screen sharing in communication tools like Teams.
function Share-PartialScreen {
[CmdletBinding(DefaultParameterSetName='Preset')]
Param(
[Parameter(Mandatory = $false)]
[string] $preset,
[Parameter(Mandatory = $false)]
[int] $Width = 1920,
[Parameter(Mandatory = $false)]
[int] $Height = 1080
)
@cbrgm
cbrgm / .skhdrc
Created June 16, 2021 16:32
yabai + skhd + spacebar dotfiles
####### Shortcut Hotkeys #############
# open terminal
alt - return : open -n /Applications/Alacritty.app
# restart Yabi, SpaceBar, and SKHD
alt + shift - r : \
launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"; \
skhd --reload
@sindresorhus
sindresorhus / esm-package.md
Last active May 18, 2024 09:04
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
#!/bin/bash
set -eo pipefail
echo "Deleting existing hosting releases"
SITE=$1
echo "Site: $SITE"
HEADER_AUTH="Authorization: Bearer "$(gcloud auth application-default print-access-token)"";
'use strict';
const {
AsyncResource,
executionAsyncId,
createHook,
} = require('async_hooks');
const EventEmitter = require('events');
const util = require('util');
@thehig
thehig / screenshots.spec.js
Created September 19, 2018 12:33
js: Storyshots with multiple device/viewport puppeteer screenshots
import path from 'path';
import fs from 'fs';
import initStoryshots from '@storybook/addon-storyshots';
import { imageSnapshot } from './storyshots-puppeteer';
import devices from 'puppeteer/DeviceDescriptors';
// Store the screenshots outside the source folder to prevent jest from 'watching' them.
// Since they're outside the src directory we nav to them relatively
const ROOTDIR = path.join(__dirname, '../../../');
@MadLittleMods
MadLittleMods / express-serve-targz-of-directory.js
Last active November 20, 2018 12:07
Stream .tar.gz of some glob (directory, etc). See .zip equivalent, https://gist.github.com/MadLittleMods/72bc11761e05a2658d0be13fa8c27fef
const Promise = require('bluebird');
const path = require('path');
const fs = require('fs-extra');
const stat = Promise.promisify(fs.stat);
const glob = Promise.promisify(require('glob'));
const tarstream = require('tar-stream');
const zlib = require('zlib');
const express = require('express');
function targzGlobStream(globString, options) {
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 18, 2024 23:08
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@fdidron
fdidron / App.js
Last active April 11, 2023 13:54
React Router v4 Auth
//Usage
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Route from './AuthRoute';
import Login from './Login';
import Private from './Private';
export default () =>
<Router>