Skip to content

Instantly share code, notes, and snippets.

@cletusw
cletusw / attribute-web-components.txt
Last active August 29, 2015 14:04
Attribute Web Components (Decorators?)
View live: http://bl.ocks.org/cletusw/64a0e8fda34eba1b8cd1
TODO: Make dynamic (adding or removing the attribute adds or removes the functionality)
#!/bin/bash
show_usage () {
echo "Usage: `basename $0` [START [END]]"
echo
echo "Steps through the commit history from START to END,"
echo "then returns to the branch or commit from before execution."
echo
echo "START defaults to the root commit (beginning of history)."
echo "END defaults to current branch/commit."
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@cletusw
cletusw / polymer-element.sublime-snippet
Last active December 21, 2015 01:19
Here's a Sublime Text snippet for quickly creating polymer-elements. Just type "<polymer" and press TAB to generate the empty element, then tab through the different fields to add a name (which is automatically mirrored to the Polymer() call), attribute default values in the prototype (which are automatically mirrored to the "attributes" attribu…
<snippet>
<content><![CDATA[
<link rel="import" href="../../bower_components/polymer/polymer.html">
<polymer-element name="$1" attributes="${2/:[^\n$]*(\n[ \t]*|$)/ /g}">
<template>
<style>
:host {
display: block;
}