Skip to content

Instantly share code, notes, and snippets.

@jsonberry
jsonberry / 01.js
Last active November 28, 2024 04:01
practice!
// loop over this "green" array, log out the color property of each object
const green = [
{
color: 'green',
},
{
color: 'green',
},
{
@jsonberry
jsonberry / prot-war-big-guns
Created September 12, 2022 03:24
WoW Shadowlands S4 Protection Warrior Weak Auras
!WA:2!DB1wZTrsv4OA2q8ozzXxI9gNDHOkM1SuaghNefipHghPnkRILZi54KTGvtpZ0sthpAMXDpJKL52gryXCheWYLD5YQkab2auLEHxP8VGtPIk)aYpHu8dGtpJKJDivbl7lu4h009PpN(C7781o11MuOF2fo9clnzJjTN0ENf6s4wfPE1dDU9mpW0NBt5AeRnS5(bbJR5Y2EBc3oDfFF3qwaFRs1QjOHx6VDYZACi8pE7rcAE3t(6OG(eplhF(Q(mVqZLZTsLC69tU1L9D95xovQuk6IaIf9WCIviZ3tKrxes4HQAmpwOQzn8JWrTtiNvVoLloX88HlFJE2uZOA1Q0oGYVuUIRMFTIAH4gDseNSuhra11TGTq9bIitAtQxyzuB2w9RUC2YvQwUsw9kArOtmdCjTPCDpsdQqvpwvZlrjUHo7z6QCkAQE5vZvSy3iVHHGAFlF3OgELLzGIjNyZIe3(z6s8yniYSjd8m5HP0889O7sjcA5qECX9idSXyuQrvzeZfulFpBrhPoY8bMtRbH5H2cZbF0JaVimp8XWLp7JlrN4YQ7bJXXIMmIs1dJyDADzLuvZ1NyNxtW2MoJEJiSLPQHvfRzGfu1TCjcHCLziXfZq5YbMd71jDhffLvvwCHZ1PoNzldRtPFrEsUrD0fwODkMjTtNEjFZzxNgmr5nJiCA68rUUPx3Hfs7XJdj5DSRDBSqZSQZ9JcgAvzmcpSMWNhcZ1RgA1YmULl1OtKGwK1Gf6O7k)C0hI4ik3J4EnSMHx4gpaRByQ7fMhHp(Ct9SxSWALhqIcryxPGyeL6UjEjbB(0dbGf8Wnk9c9TAMCxhpLr1tXSdMoG7hMUfHZz(80MS6PRh5j6kRbRZSdDoA)ACePGTssir5Hji88srY0ZS8Y65YTshUFReuXsrm7(3mJ3vkC5nDxNw2eJ4AS6QAybOvVlvsVWRwALkzlIwegJis1tIfyjHEFMxnFEcysTRG6wlEwcgBsRlSZC9yOQL9J4w0x4qWYQWhifCeyS
@jsonberry
jsonberry / DateComponent.vue
Created October 12, 2021 00:22
Vue Native Platform Date Component Strategy
<template>
<fieldset class="date-input" :data-qa-id="id">
<legend>{{ legend }}</legend>
<component
@change="onChange($event)"
:is="component"
:custom-validity="customValidity"
v-bind="$props"
/>
</fieldset>
@jsonberry
jsonberry / readme.md
Created November 27, 2019 21:51
Injecting Actions Service for profit

Reference to this twitter thread: https://twitter.com/jsonberrry/status/1199566382716731393

Subject: "injecting the actions service into the component level as a means for propagating success/error states to a presentational layer"

Question from @jdpearce

"“Injecting the actions service...” woah, woah, woah...what?!

Why aren’t you setting a property in the store and selecting that?"

@jsonberry
jsonberry / app.component.ts
Last active February 20, 2019 04:25
Reactive Angular Scroll Position Restoration with RxJS
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { Event, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { asyncScheduler } from 'rxjs';
import { filter, observeOn, scan } from 'rxjs/operators';
interface ScrollPositionRestore {
event: Event;
positions: { [K: number]: number };
trigger: 'imperative' | 'popstate';
idToRestore: number;
@jsonberry
jsonberry / composability.ts
Last active January 9, 2019 03:39
rxjs-toolkit examples
import { someApiService } from './some-api.service';
import { propsAreTruthy, ignoreFalsySignals } from 'rxjs-toolkit';
// imagine getSource$ return an object like this:
const exampleSource = {
id: '123',
origin: {
name: '',
url: 'noop.com',
}
@jsonberry
jsonberry / propsAreTruthy.ts
Last active January 13, 2019 19:05
rxjs-toolkit examples
import { of } from 'rxjs';
import { propsAreTruthy, tapLog } from 'rxjs-toolkit';
const source$ = of({
foo: {
bar: {
baz: 'truthy!',
},
},
zap: {
@jsonberry
jsonberry / propsAreTruthy.ts
Last active January 14, 2019 16:58
rxjs-toolkit examples
import { from } from 'rxjs';
import { propsAreTruthy, tapLog } from 'rxjs-toolkit';
const topLevelTruthy = {
one: 'I',
two: 'am',
three: 'truthy',
iHaveNestedProps: { // top level also truthy
nested: null,
},
@jsonberry
jsonberry / ignoreFalsyValues.ts
Last active January 14, 2019 17:01
rxjs-examples
import { someDataSource } from './some-api.service';
import { ignoreFalsySignals, tapLog } from 'rxjs-toolkit';
interface Signal {
foo: string;
}
/**
* signals$ pushes out an Observable of Signal
* imagine the source of the stream is the return from an API call
@jsonberry
jsonberry / ignoreFalsyValues.ts
Last active January 13, 2019 18:48
rxjs-examples
import { from } from 'rxjs';
import { ignoreFalsySignals, tapLog } from 'rxjs-toolkit';
from([
'I',
false,
'am',
null,
'truthy',
]).pipe(