Skip to content

Instantly share code, notes, and snippets.

Avatar
❤️
FOSS

Dave Mackintosh davemackintosh

❤️
FOSS
View GitHub Profile
View inConfig.js
const config = {
"e02c2064-d961-4feb-lll4-558e0dd596d1": {
user: {
name: "Ian",
},
},
"f662b7aa-e2ff-4406-97c3-c0c6cb511159": {
user: {
name: "Greg",
},
View form-state.jsx
import React from "react"
export const MyFormWithState = (props) => {
const [formState, setFormState] = useState({
name: "",
age: 0,
})
const onChange = (event) =>
setFormState({
View hoc-composer.jsx
function compose(...composable) {
return (component) =>
composable.reduceRight((children, Composable) => {
return <Composable>{children}</Composable>
}, component)
}
// compose(withRouter, withMyHOC, withYourHOC)(MyComponent)
export default compose
View node-repl-row-counter.ts
function renderLines(lines: number = 2): number {
const columns = process.stdout.columns
const resultingText = ("a").repeat((columns * lines))
const result = resultingText.length / columns // -- in testing this was like 1.99999467 so I ceil it
return Math.ceil(result) // -- lines
}
View arch-install.sh
#!/bin/env bash
# EDIT THESE IF YOU WANT #####
# Locale
keyboard=us
encoding="UTF-8"
locale="en_GB"
# Time/Date
zone=Europe
View keybase.txt
### Keybase proof
I hereby claim:
* I am davemackintosh on github.
* I am davemackintosh (https://keybase.io/davemackintosh) on keybase.
* I have a public key ASBvMm9V7prKvnT3WzoizYU_PmC7hKpMIAh_CT8qzBKU8go
To claim this, I am signing this object:
View keybase.md

Keybase proof

I hereby claim:

  • I am davemackintosh on github.
  • I am davemackintosh (https://keybase.io/davemackintosh) on keybase.
  • I have a public key ASCZERzPIswFJ2S8J0GfU4beuavHa7dlU4Ji7jvqVpCuZAo

To claim this, I am signing this object:

@davemackintosh
davemackintosh / amazonProgress.js
Created Jan 18, 2018
Run in a console on the track package page of an Amazon order and you'll get a new localStorage entry each time it's run to track progress through the day.
View amazonProgress.js
(function getProgress() {
if (!localStorage.amazonProgress)
localStorage.amazonProgress = "[]"
const store = JSON.parse(localStorage.amazonProgress)
store.push({
time: Date.now(),
progress: JSON.parse(document.querySelector("script[type=\"a-state\"]").innerText).progressTracker.lastTransitionPercentComplete
})
View config.cson
"*":
"atom-beautify":
general:
_analyticsUserId: "84ce3362-ebdd-471a-8152-d2c71fda5e1d"
js:
beautify_on_save: true
indent_char: " "
indent_size: 2
unescape_strings: true
core:
View keybase.md

Keybase proof

I hereby claim:

  • I am davemackintosh on github.
  • I am davemackintosh (https://keybase.io/davemackintosh) on keybase.
  • I have a public key whose fingerprint is 8CDF EE77 B2FA 1174 8498 45B7 1DBC 6AAF 311A 1F35

To claim this, I am signing this object: