Skip to content

Instantly share code, notes, and snippets.

View codebender828's full-sized avatar
⚡️
Writing history

Jonathan Bakebwa codebender828

⚡️
Writing history
View GitHub Profile
@codebender828
codebender828 / machine.js
Last active July 2, 2021 10:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@codebender828
codebender828 / name-me.js
Created May 28, 2020 03:28
What do you name this function? It transforms an array of objects into an object with `values` and an `allKeys` array.
// So I'm struggling to name this function so I called it `indexArrayBy`
// but it's really doing more. Here's a link to it's demo:
// Demo: https://playcode.io/612180/
/**
* Transforms an array of objects into an object containing the values
* indexed by a unique property on each object, e.g. id and
* an array containing all the keys (So you get the keys).
*
* @param {Array<Object>} array Array of objects
@codebender828
codebender828 / notify-plugin.js
Last active August 13, 2021 10:36
How to custom Vue notifications API with Breadstick.
import Vue from 'vue'
import Breadstick from 'breadstick'
// 1. Create a new breadstick instance
export const breadstick = new Breadstick()
// 2. Import your custom Notification component.
// You can use it to render your notifications message.
const MyNotification = () => import('@/components/MyNotification.vue')
@codebender828
codebender828 / gist:87b901869d333b234fc55eb50bd6ef68
Last active October 30, 2021 06:42
📊 Weekly codebending breakdown
We couldn’t find that file to show.
@codebender828
codebender828 / machine.js
Last active December 16, 2019 09:23
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@codebender828
codebender828 / modal.vue
Created July 3, 2019 07:10
How to use modal component in parent component
<!-- Parent Component -->
<template>
<div>
<modal :show-modal="showModal">
<h1 slot="header">{{ title }}</h1>
<p slot="body">{{ body }}</p>
<div slot="footer">
<base-button
@click.native="hideModal"
>