Skip to content

Instantly share code, notes, and snippets.

import 'dart:async';
// Run at: dartpad.dev/4cfeeb62db10d88de448c98f626c317d
// A stream
Stream<String> getWordStream({delay = 1}) async* {
for(int index = 0; index < words.length; index++) {
final word = await fetchWord(index, delay:delay);
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
// The data we display
class Family {
int id;
String name;
Family(this.id, this.name);
  • foo
  • bar
    • subbar
    • subpar
  • ook?
@jonmountjoy
jonmountjoy / check-for-addon.rb
Created August 22, 2013 16:14
Checks all your apps - returns those that have an add-on matching the name in the regular expression.
#!/usr/bin/env ruby
# gem install 'heroku-api'
require 'rubygems'
require 'heroku-api'
ADDON=/memcache.*/
api_key = `heroku auth:token`
@jonmountjoy
jonmountjoy / gist:5533347
Last active December 17, 2015 02:08
test

with just a newline

test test

test test

with newline with 2 spaces

@jonmountjoy
jonmountjoy / gist_fetch.sh
Created September 25, 2012 14:18
fetch my gists
# first you need to do a one-time setup step to create an OAuth token:
# do this to create an app with your OAUTH token
#
# curl -u github-user-name:github-password -H "Content-Type: application/json" -X POST -d '{"scopes":["gist"], "note": "gist backup"}' \
# https://api.github.com/authorizations
#
# export GIST_OAUTH_TOKEN=xxxxx <<- token retrieved from the curl
#
curl -H "Authorization: token `echo $GIST_OAUTH_TOKEN`" -H "Content-Type: application/json" -X GET https://api.github.com/gists | \
perl -ne 'if (m/.*raw.*(https.*)".*/){ print "$1\n"; }' | \
@jonmountjoy
jonmountjoy / AppServerConfiguration.rb
Created April 7, 2011 11:04
In progress - wanting to generalise this solution for multiple sub-configuration types...
class AppServerConfiguration
attr_accessor :port, :admin_password
end
class FooServerConfiguration
attr_accessor :moo;
end
class Configuration
attr_accessor :tail_logs, :max_connections, :admin_password
@jonmountjoy
jonmountjoy / counter_closure.rb
Created April 7, 2011 10:00
in chad fowler session
def counter(start=0, increment=1)
lambda do
val = start
start+=increment
val
end
end
result = counter(10,2)