Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="import" href="countdown_clock.html">
</head>
<body>
<h1>Alarm</h1>
<div is="countdown-clock"></div>
<script type="application/dart" src="alarm.dart"></script>
import 'dart:async';
import 'package:polymer/polymer.dart';
import 'package:observe/observe.dart';
class CountdownClock extends CustomElement with ObservableMixin {
static final oneSecond = new Duration(seconds: 1);
@observable var timeLeft = new Duration(seconds: 72);
/*
void main() {
}
@nikgraf
nikgraf / run_dartium.dart
Created July 12, 2013 23:45
A small script to start Dartium with type checks and asserts enabled on OSX. To run it you need the Dart editor and added the `dart` command to $PATH
#!/usr/bin/env dart
import 'dart:io';
import 'dart:async';
main() {
// find and run Dartium with type checks and asserts enabled
var whichDart = Process.run('which', ['dart']);
whichDart.then((command) {
var dartiumExecutable = new Path(command.stdout).join(new Path('../../../chromium/Chromium.app/Contents/MacOS/Chromium'));
@nikgraf
nikgraf / chai-react-shallow.js
Created December 18, 2015 07:37
Chai React Shallow Testing
import {findAll} from 'react-shallow-testutils';
import objectMatches from 'object-matches';
import inspectReactElement from 'inspect-react-element';
const findAllMatching = (rootElementTree, elementTreeToMatch) => {
return findAll(rootElementTree, (element) => {
// In case a null is passed for a template value
if (element === null) return false;
const matchType = (elementTreeToMatch.type ? element.type === elementTreeToMatch.type : true);
<x-secret placeholder="Choose a Password"></x-secret>
library cookie;
import 'dart:html';
/*
* dart document.cookie lib
*
* ported from
* http://www.quirksmode.org/js/cookies.html
*
try {
doSomething()
} catch(error) {
Raven.captureException(error)
}
Raven.captureMessage('hello world!');
<script src="//d3nslu0hdya83q.cloudfront.net/dist/1.0.5/raven.min.js" type="text/javascript">
</script>
<script type="text/javascript">
Raven.config('https://ac459699bb384140a7e69a3d15890000@app.getsentry.com/3100').install()
</script>