Skip to content

Instantly share code, notes, and snippets.

View fdjones's full-sized avatar

Freddie fdjones

View GitHub Profile
/Users/me/.cache/mill/download/0.8.0: line 19: /Users/me/Library/Caches/Coursier/arc/https/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11%252B28/OpenJDK11-jdk_x64_mac_hotspot_11_28.tar.gz/jdk-11+28/Contents/Home/bin/java: No such file or directory
/Users/me/.cache/mill/download/0.8.0: line 19: exec: /Users/me/Library/Caches/Coursier/arc/https/github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11%252B28/OpenJDK11-jdk_x64_mac_hotspot_11_28.tar.gz/jdk-11+28/Contents/Home/bin/java: cannot execute: No such file or directory
@fdjones
fdjones / machine.js
Created April 13, 2020 12:44
Generated by XState Viz: https://xstate.js.org/viz
function isAuthenticated() {
return Promise.resolve(true);
}
const appMachine = Machine({
id: 'app',
initial: 'idle',
context: {
retries: 0
},
@fdjones
fdjones / machine.js
Last active April 12, 2020 11:27
Generated by XState Viz: https://xstate.js.org/viz
function fetchQuestions() {
return Promise.resolve([
{ name: 'bob' },
{ name: 'bill' },
{ name: 'mary' }
]);
}
const test = Machine({
const AddTodo: React.FC = (): React.ReactElement => {
const [userInput, setUserInput] = React.useState("");
const dispatch = useDispatch();
const handleAddTodo = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.key === "Enter") { // Property 'key' does not exist on type 'ChangeEvent<HTMLInputElement>'.ts(2339)
dispatch(add({ id: uuidv4(), task: "bob" }));
}
};
return (
@fdjones
fdjones / .ts
Last active January 5, 2020 10:55
// doesn't work
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
const todo = createSlice({
name: "todo",
initialState: [],
reducers: {
add: (state, action: PayloadAction<string>) => {
state.push(action.payload); // Argument of type 'string' is not assignable to parameter of type 'never'.ts(2345)
}
// here is your normal component. at the moment, it doesn't do anything really.
class App extends React.Component {
render() {
return (
<div className="App">
<h1>Counter: {counter}</h1>
<button onClick={() => {}}>+</button>
<button onClick={() => {}}>-</button>
</div>
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon src/app.js"
},
"keywords": [],
"author": "",
const foo = () => {
return (
<div>
<div>foobar</div>
</div>
)
}
const foo = () => {
return (
@fdjones
fdjones / cdm.js
Last active March 28, 2019 22:17
class App extends React.Component {
constructor(...props) {
super(...props);
}
render() {
const { match, history } = this.props;
return (
<Route
exact
let pickList;
setTimeout(async () => {
const foo = await apiCallWrapper(store, getParcelPickListItems, parcel.id);
pickList = foo[0];
}, 5000);