Skip to content

Instantly share code, notes, and snippets.

View Pitt-Pauly's full-sized avatar

Pitt Pauly Pitt-Pauly

View GitHub Profile
@Pitt-Pauly
Pitt-Pauly / get Redux state in console
Created August 3, 2021 10:27
get Redux state in devtools console
// ref: https://stackoverflow.com/questions/49541235/how-to-get-content-of-redux-store-in-console-without-devtools
function getStore() {
const appStates = []
const reactRoot = document.getElementById('root')
let base
try {
base = reactRoot._reactRootContainer._internalRoot.current
} catch (e) {
console.log('Could not get internal root information from reactRoot element')
@Pitt-Pauly
Pitt-Pauly / keybase.md
Last active March 6, 2019 13:45
Keybase ID proof

Keybase proof

I hereby claim:

  • I am pitt-pauly on github.
  • I am ppitt (https://keybase.io/ppitt) on keybase.
  • I have a public key ASBNmjnDZBWmwbM98hU52jpOyFztQOy-Y0_mlUkveW8iygo

To claim this, I am signing this object:

@Pitt-Pauly
Pitt-Pauly / README.md
Last active October 26, 2018 06:59
VSCode & NVM Unity launcher + script

Launch VSCode with the default Node version set - via Unity

So VSCode has an annoying bug that forces people to run nvm set before launching VSCode for it to recognise which node binary to use.

Since I am lazy I made a unity .desktop shortcut for it which launches a small script that does exactly that!

This could be extended in the future to include the option to use other Node versions too, and launching VSCode with them with the right click options.

I hope this saves people some time :)

@Pitt-Pauly
Pitt-Pauly / .bash_prompt
Last active July 31, 2018 13:17
My pretty prompt!
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@Pitt-Pauly
Pitt-Pauly / StringReplaceBenchmark.py
Created June 28, 2017 15:32
Python string replacement benchmark
import re, string, timeit
s = "string. With. Punctuation"
exclude = set(string.punctuation)
table = string.maketrans("","")
regex = re.compile('[%s]' % re.escape(string.punctuation))
def test_set(s):
return ''.join(ch for ch in s if ch not in exclude)