Skip to content

Instantly share code, notes, and snippets.

View jonboiser's full-sized avatar

Jonathan Boiser jonboiser

View GitHub Profile
@jonboiser
jonboiser / machine.js
Last active July 27, 2021 19:37
Generated by XState Viz: https://xstate.js.org/viz
// - XState (all XState exports)
const enterConfirmationStage = (context, event) => {
context.atConfirmationStage = true;
console.log(context)
};
const exitConfirmationStage = (context, event) => {
context.atConfirmationStage = false;
};
@jonboiser
jonboiser / machine.js
Last active August 24, 2020 17:12
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jonboiser
jonboiser / machine.js
Last active August 24, 2020 17:22
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
from kolibri.core.auth.models import FacilityUser, Facility, Role
from faker import Faker
"""
pip install Faker if you don't have it
"""
FAKE = Faker()
"""

Organizing Page States in Vuex Modules

Summary

Prior to this pull request, the pattern for rendering pages was as follows:

  1. When browser goes to a route, the router executes a handler function (with a name like showClassesPage)
  2. The handler will have some standard effects on the Vuex store (e.g. show loading page, update a pageName field that matches the route's name, etc.). It will usually request some data from the server and then terminate by committing a SET_PAGE_STATE mutation that copies that server data into Vuex inside of the pageState field.
  3. The Vue component that is mapped to pageName will render and pull the data it needs to present from pageState.

After this Pull Request, this flow changes in the following manner:

@jonboiser
jonboiser / khan academy topics.txt
Created June 8, 2017 22:28
khan academy topics 'slugs' list
"1-digit-multiplication-division"
"1600s-1800s"
"16th-18th-century"
"1920s-america"
"1950s-america"
"1960s-america"
"1970s-america"
"1980s-america"
"1990s-america"
"19th-century"
# initialization file (not found)
@jonboiser
jonboiser / rtg.scss
Created January 12, 2017 22:29
rtg example
@media (min-width: 769px) {
.mark-all-read{
margin-left: auto;
}
}
@media (max-width: 768px) {
.date-time{
font-size: 1rem;
}
declare module 'reflexbox' {
declare type Range6 = 0 | 1 | 2 | 3 | 4 | 5 | 6;
declare type Range12 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
declare type BaseProps = {
auto?: boolean,
gutter?: number,
col?: Range12,
sm?: Range12,