Skip to content

Instantly share code, notes, and snippets.

View ducin's full-sized avatar
🛠️
creatin' some stuff

Tomasz Ducin ducin

🛠️
creatin' some stuff
View GitHub Profile
@ducin
ducin / machine.js
Last active May 26, 2021 22:43
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'AuthorizeDevice',
initial: 'chooseMethod',
states: {
chooseMethod: {
on: {
CHOOSE_ADD_DEVICE: 'addDeviceForm',
}
},
addDeviceForm: {
@ducin
ducin / machine.js
Last active May 26, 2021 22:47
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'AuthorizeDevice',
initial: 'chooseMethod',
states: {
chooseMethod: {
on: {
CHOOSE_ALLOW_ONCE: 'allowOnceToken',
CHOOSE_ADD_DEVICE: 'addDeviceForm',
CHOOSE_LOGOUT: 'loggedOut',
}
@ducin
ducin / machine.js
Last active May 26, 2021 22:51
Generated by XState Viz: https://xstate.js.org/viz
// CORRECT SUBMIT EVENT:
// {
// "type": "SUBMIT",
// "password": "1234"
// }
// pure mocks
const delay = (time) => {
return new Promise((res, rej) => {
@ducin
ducin / ecommerce-order.json
Created January 26, 2020 17:12
various json schemas
{
"type": "object",
"properties": {
"orderId": {
"type": "string",
"faker": "random.uuid"
},
"customer": {
"type": "string",
"faker": "name.findName"
@ducin
ducin / actions.ts
Last active February 15, 2021 01:02
redux setup
import { INC } from './constants';
export const Inc = () => ({
type: INC as typeof INC
})
export type Actions =
| ReturnType<typeof Inc>
@ducin
ducin / ^.md
Last active October 30, 2021 11:58
Functional Composition with Static Types in TypeScript, Tomasz Ducin, Wrocław TypeScript #3, 2019.03.27
@ducin
ducin / ^.md
Last active January 12, 2022 13:29
Functional Composition with Static Types in TypeScript, Tomasz Ducin, Warsaw TypeScript #2, 2019.02.06
@ducin
ducin / LICENSE
Created December 28, 2018 13:12
Lorem Ipsum License
Lorem Ipsum License
Copyright (c) [year] [fullname]
Permission is Lorem ipsum hereby granted, dolor sit amet, free of charge,
to any person obtaining a copy consectetur adipiscing elit. Proin nibh augue
of this software and associated documentation files (the "Software"),
suscipit a, scelerisque sed, to deal lacinia in, mi. Cras vel lorem.
Etiam pellentesque aliquet tellus, in the Software without restriction,
Phasellus pharetra nulla ac diam. Quisque semper justo at risus including
@ducin
ducin / .gitignore
Last active November 15, 2018 13:58
data.json
node_modules
@ducin
ducin / model.js
Created September 15, 2018 18:31
const API_URL = 'http://localhost:3011/'
const OfficeModel = {
getCollection(){
return fetch(`${API_URL}offices`)
.then(res => res.json())
},
async __extendOfficeWithEmployees(office){
const employees = await EmployeeModel.getCollection(office.city)
return { ...office, employees }