Skip to content

Instantly share code, notes, and snippets.

@timhall
timhall / gist:2734e7d858a7d8c54360
Last active March 8, 2024 20:19
VBA-Web - Google Calendar API
' (Based of Analytics example)
' In Client setup, set BaseUrl and Scope for Calendar
Client.BaseUrl = "https://www.googleapis.com/calendar/v3/"
Auth.AddScope "calendar"
Public Type CalendarEvent
Summary As String
Location As String
Attendees As Collection
StartTime As Date
@timhall
timhall / rAF-polyfill-performance.js
Created November 15, 2012 13:17
Updated requestAnimationFrame polyfill that uses new high-resolution timestamp
// Updated requestAnimationFrame polyfill that uses new high-resolution timestamp
//
// References:
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// https://gist.github.com/1579671
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
//
// Note: this is my initial stab at it, *requires additional testing*
(function () {
@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;
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 / gist:bab59824216aefb5f61b
Created November 9, 2014 02:03
Excel-REST Basic Authentication
' Create Client
Dim Client As New RestClient
Client.BaseUrl = "https://..."
' Create HttpBasicAuthenticator
' https://github.com/timhall/Excel-REST/tree/master/authenticators
Dim Auth As New HttpBasicAuthenticator
Auth.Setup "Username", "Password"
' Add Authenticator to Client
@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>
@timhall
timhall / gist:c88e52a71acc45243bbb
Last active October 23, 2017 22:14
Excel-REST - Smartsheet API: Update
' curl https://api.smartsheet.com/1.1/row/{rowId}/cells \
Dim Request As New RestRequest
Request.Resource = "row/{rowId}/cells"
Request.AddUrlSegment "rowId", "RowId..."
' -H "Authorization: Bearer ACCESS_TOKEN" \
Request.AddHeader "Authorization", "Bearer ACCESS_TOKEN is set in authenticator"
' -H "Content-Type: application/json" \
Request.RequestFormat = json

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 / taskr-run.js
Created July 27, 2017 13:17
task.run, unified approach
const co = require('bluebird').coroutine;
let taskId = 0;
class Task {
constructor(values = {}) {
const { id = `task${taskId++}`, files = [], globs = [], value } = values;
this.id = id;
this.files = files;
this.globs = globs;