Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am timhall on github.
  • I am timhall (https://keybase.io/timhall) on keybase.
  • I have a public key ASAnerD4uXjGq9jjB0Pnk2wzWhqjDBmuu3s0ohwxJ5ZUGgo

To claim this, I am signing this object:

@timhall
timhall / App.html
Last active November 27, 2017 20:10
svelte-router
<Route path="/" exact>
Home
</Route>
<Route path="/a">
A
<Route path="/a/nested">Nested</Route>
</Route>
<Route path="/b/:id">
B {{$router.params.id}}
</Route>
Private Const API_KEY As String = "YOUR_API_KEY"
Sub CreateTracking(Carrier As String, TrackingNumber As String)
Dim Client As New WebClient
Client.BaseUrl = "https://api.aftership.com/v4"
Dim Request As New WebRequest
Request.Resource = "trackings"
Request.Method = WebMethod.HttpPost
Request.AddHeader "aftership-api-key", API_KEY
@timhall
timhall / reactive-declarations.md
Last active November 28, 2018 22:41
Pull-based reactive declarations

Reactive Declarations

To avoid issues with re-calculating immediately on change while keeping reactive values in-sync, use reactive accessors to implement pull-based computed values. Propose using computed for pull-based computed values that are kept synchronized and reactive to run functionality on initialize and before beforeUpdate.

Option 2 uses a single reactive: label and can re-run blocks as-needed based on when reactive values are accessed. I think there are a few downsides to this (side effects could happen at strange times), but it's a bit simpler since it presents a single reactive API.

// Initialized with <Component a=15 />

Reactive Declarations

To avoid issues with re-calculating immediately on change while keeping reactive values in-sync, use reactive accessors to implement pull-based reactive values.

// Initialized with <Component a=15 />

export let a = 10;
let b = 20;