Skip to content

Instantly share code, notes, and snippets.


Justin Fagnani justinfagnani

View GitHub Profile
justinfagnani / gist:8e0b18cf4604f039c859
Created Jul 17, 2014
code_transformers / analyzer
View gist:8e0b18cf4604f039c859
class InterfaceTransformer extends Transformer with ResolverTransformer {
final Resolvers resolvers;
Future<bool> isPrimary(AssetId id) => new Future.value(id.extension == '.dart');
Future<bool> shouldApplyResolver(Asset asset) {
return asset.readAsString().then((contents) {
var cu = parseCompilationUnit(contents, suppressErrors: true);
View quiver_retry_2.dart
/// Returns a [Duration] if another attempt needs to be made after
/// waiting for the returned [Duration]. Returns the error object
/// that instructs the retry mechanism to stop trying and report error
/// immediately.
typedef dynamic OnErrorFunc(Object err, int retry, Duration elapsed);
/// `onError` returns either [Duration] or an error object. If [Duration]
/// is returned, the `attempt` function will be retried after waiting
/// for the returned duration, otherwise the retry mechanism gives up
/// and evaluates the [Future] with the the error object.
Future start(
View quick-alert.html
<link rel="import" href="bower_components/polymer/polymer.html">
<dom-module id="quick-alert">
:host {
display: block;
position: fixed;
top: 0;
left: 0;
right: 0;
justinfagnani / gist:6aec137ed97cfa3db002
Last active Aug 29, 2015
Dependency Resolution with Events
View gist:6aec137ed97cfa3db002
is: 'x-foo',
ready() {
// provides a FooService to descendents
this.provideInstance('foo-service', new FooService());
attached() {
// requests a BarService from an ancestor, re-requests if moved
View gist-server.json
"polymer": "",
"webcomponentsjs": ""
View designer.html
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
:host {
position: absolute;
width: 100%;
height: 100%;
View gist:6675416
import 'dart:async';
import 'package:postgresql/postgresql.dart';
void main() {
var username = "TheRightMan";
var password = "WithTheRightSecret";
var DBname = "AtTheRightPlace";
var uri = 'postgres://$username:$password@localhost:5432/$DBname';
View gist-server.json
"font-roboto": "",
"iron-flex-layout": "",
"paper-material": "",
"paper-styles": "",
"polymer": "",
"webcomponentsjs": ""
View index.html
<!doctype html>
<script src="shadow-root.js"></script>
<div slot="main">
I'm some projected content.
justinfagnani / custom-element-conformance.js
Created Oct 8, 2017
Web Components Conformance Tests
View custom-element-conformance.js
const NativeHTMLElement = window.HTMLElement;
const documentWrite = document.write;
const documentOpen =;
window.HTMLElement = class extends NativeHTMLElement {
constructor(...args) {
console.assert(args.length === 0);
You can’t perform that action at this time.