Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Being awesome 😎

Jake 'Sid' Smith JakeSidSmith

💭
Being awesome 😎
View GitHub Profile
@JakeSidSmith
JakeSidSmith / launch-chromium
Last active Jan 9, 2020
Openbox config to launch a full screen Chromium on Raspberry Pi running Raspbian Lite
View launch-chromium
# 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 Apr 24, 2019
React higher order component to add "click outside" events to elements
View with-click-outside.ts
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 Dec 20, 2018
Class to ease process of polling an endpoint
View poller.ts
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 Oct 12, 2018
wrapThunkAction - correctly types thunk actions as if they had been mapped with dispatch
View usage.tsx
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 Jul 13, 2018
Find bad version of eslint-scope in global node_modules, nvm dir, trash, and current directory.
View README.md

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 Jun 22, 2018
Bash profile extension to automatically change NodeJS versions with NVM
View .bash_node
#! /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 Apr 2, 2018
Async's Spring 2018 Show n' Tell
View show-n-tell-spring-2018.md

[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 Mar 29, 2018
List of Brighton & Hove Design, Development, and Various Other Tech / Nerdy Meetups
View brighton-and-hove-meetups.md

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

AsyncJS https://asyncjs.com/

A JavaScript meetup for Brighton & Hove

@JakeSidSmith
JakeSidSmith / aliasify-tsconfig.js
Last active Dec 6, 2017
Create aliasify config from tsconfig.json
View aliasify-tsconfig.js
const tsconfig = require('./tsconfig.json');
const fs = require('fs');
const path = require('path');
const ASTERISK = /\*/g;
const LEADING_DOT_SLASH = /^\.\//;
const CARET = /\^/g;
const { compilerOptions: { paths } } = tsconfig;
You can’t perform that action at this time.