Skip to content

Instantly share code, notes, and snippets.

View valscion's full-sized avatar

Vesa Laakso valscion

View GitHub Profile
@valscion
valscion / app-concepts-auto_translate-callbacks-after_commit.rb
Last active April 28, 2021 22:15
Mobility + EasyTranslate. Replace dashes in file names with slashes
# frozen_string_literal: true
module AutoTranslate
module Callbacks
class AfterCommit
attr_reader :original_attribute_name, :translated_attribute_name
def initialize(original_attribute_name, translated_attribute_name)
@original_attribute_name = original_attribute_name
@translated_attribute_name = translated_attribute_name
@valscion
valscion / machine.js
Created November 7, 2019 15:28
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => {
if (event.type !== 'SEARCH_REQUEST_SUCCESS') {
throw new Error(
`Unexpected event type for handleRequestSuccess: "${event.type}"`
);
}
return event.results;
},
@valscion
valscion / machine.js
Last active November 5, 2019 14:15
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => {
if (event.type !== 'SEARCH_REQUEST_SUCCESS') {
throw new Error(
`Unexpected event type for handleRequestSuccess: "${event.type}"`
);
}
return event.results;
},
pagination: (_ctx, event) => {
@valscion
valscion / machine.js
Created November 1, 2019 12:26
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results,
pagination: (_ctx, event) => event.pagination
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
pagination: null,
@valscion
valscion / machine.js
Created November 1, 2019 12:24
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results,
pagination: (_ctx, event) => event.pagination
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
@valscion
valscion / SketchSystems.spec
Last active October 8, 2019 11:36
Closed*
Closed*
report anomaly -> Opened
Opened
close -> Closed
Ilmoita muu tilanne*
Initial*
Asiakkaalle on vastattu toisessa keskustelussa -> Button
Tilaisuus on jo raportoitu toisessa keskustelussa -> Button
@valscion
valscion / machine.js
Last active October 8, 2019 11:35
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const handleHistoryPopState = assign({
results: (_ctx, event) => event.results
});
const searchFSM = Machine({
id: 'search',
@valscion
valscion / machine.js
Created September 30, 2019 13:38
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Last active September 30, 2019 13:28
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},
@valscion
valscion / machine.js
Created September 30, 2019 07:57
Generated by XState Viz: https://xstate.js.org/viz
const handleRequestSuccess = assign({
results: (_ctx, event) => event.results
});
const searchStateMachine = Machine({
id: 'search',
initial: 'idle',
context: {
results: []
},