Skip to content

Instantly share code, notes, and snippets.

View jbrunton's full-sized avatar

John Brunton jbrunton

View GitHub Profile
@jbrunton
jbrunton / config.yml
Last active August 16, 2020 18:03
ytt - remove compose build context
services:
api:
build:
context: /path/to/my/repo/services/api
client:
build:
context: /path/to/my/repo/services/client
depends_on:
- api
- nginx
@jbrunton
jbrunton / Simple.kt
Last active November 28, 2018 00:06
AsyncResult Simple Example
val result: AsyncResult<MyData> = // ...
val viewState = result
.map { MyViewState.from(it) }
.onError(IOException::class) {
map {
if (cachedValue == null) {
failure(NoConnectionViewState)
} else {
success(cachedValue)
@jbrunton
jbrunton / view_user.js
Created April 17, 2012 13:33
view_user action
view_user: function(user_id) {
app.tmpl.renderPage('view-user-tmpl',
new User().load(user_id, {
extensions: {
urlExtender: { edit: true }
},
includes: {
blogs: true,
recent_posts: {
includes: { tags: true }
@jbrunton
jbrunton / destination.js
Created February 28, 2012 11:13
DRY, MV* example
define([
'core',
'util',
'viewmodels/geo/lat_lng'
], function(core, util, LatLng) {
var Destination = function(data) {
this.id = ko.observable();
this.title = ko.observable();