Skip to content

Instantly share code, notes, and snippets.

View JakeSidSmith's full-sized avatar
💭
Being awesome 😎

Jake 'Sid' Smith JakeSidSmith

💭
Being awesome 😎
View GitHub Profile
@JakeSidSmith
JakeSidSmith / example.md
Last active March 4, 2021 09:52
TypeScript: inference of named arguments differs from positional arguments

TypeScript version: 4.2.2

tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noUncheckedIndexedAccess": true,
@JakeSidSmith
JakeSidSmith / launch-chromium
Last active April 22, 2024 20:26
Openbox config to launch a full screen Chromium on Raspberry Pi running Raspbian Lite
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
@JakeSidSmith
JakeSidSmith / with-click-outside.ts
Created April 24, 2019 12:58
React higher order component to add "click outside" events to elements
import React, { MouseEvent, PureComponent } from 'react';
interface Props {
onClickOutside: () => any;
}
// @TODO: element should be constrained to 'keyof ReactHTML' but this causes some crazy memory leak
export const withClickOutside = (element: string) => {
const Element = element;
@JakeSidSmith
JakeSidSmith / poller.ts
Created December 20, 2018 16:07
Class to ease process of polling an endpoint
import axios, { AxiosRequestConfig, AxiosError, AxiosResponse, CancelTokenSource } from 'axios';
interface PollOptions<PollResponse, CompleteResponse> {
interval: number;
shouldContinuePolling: (response: PollResponse | CompleteResponse) => response is PollResponse;
isComplete: (response: PollResponse | CompleteResponse) => response is CompleteResponse;
onStart?: () => any;
onStop?: () => any;
onError: (error: AxiosError) => any;
onComplete: (response: CompleteResponse) => any;
@JakeSidSmith
JakeSidSmith / usage.tsx
Last active October 12, 2018 14:29
wrapThunkAction - correctly types thunk actions as if they had been mapped with dispatch
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { wrapThunkAction } from './somewhere';
import { action } from './actions';
const wrappedAction = wrapThunkAction(action);
interface DispatchProps {
action: typeof wrappedAction;
@JakeSidSmith
JakeSidSmith / README.md
Last active July 13, 2018 09:57
Find bad version of eslint-scope in global node_modules, nvm dir, trash, and current directory.

Running this script locally

  1. cd into your "projects" directory, or whatever folder all of your projects are stored in.

  2. Run the following:

curl -s https://gist.githubusercontent.com/JakeSidSmith/0ddc45b08cacc8152492ba8f2598345b/raw/4fc8d7b4a5b319a3ce4951098c1d2626eb9d8342/find-eslint-scope | bash
@JakeSidSmith
JakeSidSmith / .bash_node
Created June 22, 2018 11:36
Bash profile extension to automatically change NodeJS versions with NVM
#! /usr/bin/env bash
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
COLOR_NONE="\033[1;39m"
NVMRC=".nvmrc"
function check_node_version () {
@JakeSidSmith
JakeSidSmith / show-n-tell-spring-2018.md
Last active April 2, 2018 17:00
Async's Spring 2018 Show n' Tell

[Async's][async] [2018 Spring Show n' Tell][event]

Thursday 5th April, 2018

  • [Full info on the Async website][event]

Speakers gist

Would you like to speak on the night? You'll have five minutes to tell us about something: a project, a library, a technique, a story, or anything else about JavaScript, HTML, CSS, or the wider world of tech.

@JakeSidSmith
JakeSidSmith / brighton-and-hove-meetups.md
Last active March 29, 2018 16:36
List of Brighton & Hove Design, Development, and Various Other Tech / Nerdy Meetups

ANNOUNCEMENT: We've moved all of these meetups to a better maintained website called Brighton Brains - add it to your bookmarks, share it on your social media, etc. :D

Brighton & Hove Design, Development, and Related Meetups

Development

A JavaScript meetup for Brighton & Hove