Skip to content

Instantly share code, notes, and snippets.

@riddla
riddla / SketchSystems.spec
Last active March 20, 2019 09:30
BulkPurchaseInquiryForm&
BulkPurchaseInquiryForm&
data
invalid*
VALID_DATA -> valid
valid
INVALID_DATA -> invalid
RESET -> invalid
input
pristine*
USER_INPUT -> dirty
@riddla
riddla / step.js
Last active March 25, 2019 12:45
Suppress render React component conditionally
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
export const Step = ({title, children, id, state}) => {
if (state && !(state.present.ui.step === Number(id))) {
console.log('step denied');
return null;
}
return (
@riddla
riddla / .eslintrc.js
Created February 27, 2019 07:28
ESLint config for TypeScript and Vue
module.exports = {
root: true,
env: {
node: true
},
extends: [
'prettier',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
@riddla
riddla / gs-xpswd
Created June 11, 2019 11:23
remove password from pdf file using ghostscript
# Ghostscript command to remove the password from an encrypted pdf document.
# Replace ENCRYPTED.pdf with the path to your password protected pdf file.
# The unencrypted file is created as OUTPUT.pdf in the same directory.
# Install Ghostscript on the Mac with brew install gs
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=OUTPUT.pdf -c .setpdfwrite -f ENCRYPTED.pdf
@riddla
riddla / SketchSystems.spec
Last active February 18, 2020 09:31
User Registration
User Registration
Pending*
startConfirmationFlow -> Confirmation Flow
deny -> Denied
Confirmation Flow
Fetch Customer Brands
brandsReceived -> Approved
empty -> Partner has no brands
failed -> Api Error
@riddla
riddla / RefreshContent.js
Last active February 21, 2020 16:50
Triggering Gatsbys __refresh webhook via a React component (ENABLE_GATSBY_REFRESH_ENDPOINT=true)
import React, { useState } from 'react'
import { setConfig } from 'react-hot-loader'
let style = {
position: 'fixed',
cursor: 'pointer',
top: 0,
right: 0,
background: 'green',
color: 'white',
@riddla
riddla / .babelrc
Last active May 23, 2021 07:20
Debug ES6 React using Jest with Visual Studio Code (VSCode)
{
"presets": [
"react",
"es2015"
],
"sourceMaps": "inline",
"retainLines": true
}
@riddla
riddla / machine.js
Created June 16, 2021 10:36
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions