Skip to content

Instantly share code, notes, and snippets.

@terrasea
terrasea / clickcounter.html
Last active August 29, 2015 14:05
Example styled element using core_style.html
<!-- import polymer-element's definition -->
<link rel="import" href="packages/polymer/polymer.html">
<link rel="import"
href="packages/paper_elements/paper_button.html">
<link rel="import"
href="packages/core_elements/core_style.html">
<polymer-element name="click-counter" attributes="count">
<template>
@terrasea
terrasea / index.html
Created August 6, 2014 05:23
Using @ComputedProperty to make x+y == z expression into an Observable expression
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Initiative tracker</title>
<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>
@terrasea
terrasea / index.html
Last active August 29, 2015 13:59
Example of testing a Polymer Dart Element with version >=0.10.0-pre.7 <0.11.0 which seems to work
<html>
<head>
<!-- Make polymer work (this is for future reference for the next version of Polymer Dart > 10.0.0) -->
<link rel="import" href="packages/polymer/polymer.html">
<!-- Load component(s) -->
<link rel="import" href="markdown-markup.html">
<script src="packages/unittest/test_controller.js"></script>
</head>
<body>
<script type="application/dart" src="test.dart"></script>
<polymer-element name="store-changes-load" attributes="count">
<template>
<style>
:host {
display: none;
}
</style>
</template>
<script type="application/dart" src="store_changes_load.dart"></script>
</polymer-element>
@terrasea
terrasea / secret_santa.dart
Created December 8, 2013 12:18
Dart Dare - Secret Santas
import 'dart:html';
class Person {
String firstname;
String lastname;
Person(this.firstname, this.lastname);
@terrasea
terrasea / flatten_list_of_lists.py
Last active September 27, 2015 17:38
Flattens a list of lists into just a list
#The list of lists
list_of_lists = [range(4), range(7)]
#flatten the lists
flattened_list = [x for y in list_of_lists for x in y]
#or using itertools
list(itertools.chain(*list_of_lists))