Skip to content

Instantly share code, notes, and snippets.

@garlicnation
garlicnation / gist:f2d6d1c6796d7cfb353f
Last active August 29, 2015 14:23
Sharding roadmap.
1) A single shared module between pages, manually specified
2) N shared modules between pages, manually specified
3) Automatically generate iframes to prime the cache
4) http2/spdy support
5) No need to specify modules, we figure out a layout for your app automatically based on endpoints.
6) Generate a pure-HTML5(No webcomponents) index.html w/ styles from polymer elements for an extremely fast time to first paint. This page should have custom element tags so as to progressively enhance when polymer loads.
@garlicnation
garlicnation / iron-button-state.html
Last active August 29, 2015 14:27
Lines 23 and 129-130 are of interest.
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<paper-tabs scrollable id="active" attr-for-selected="value" selectable selected="{{active}}">
<template is="dom-repeat" items="[[docElements]]">
<paper-tab value="[[item.is]]">[[item.is]]</paper-tab>
</template>
<template is="dom-repeat" items="[[docBehaviors]]">
<paper-tab value="[[item.is]]">[[item.is]]</paper-tab>
</template>
</paper-tabs>
@garlicnation
garlicnation / exampleBehavior.js
Created September 15, 2015 08:49
behavior singleton model
(function(){
var SocketConnection = function() {
this.connection = instanceConnection();
};
// This is a globally shared connection.
var singletonConnection = null;
window.SocketConnectionBehavior = {
@garlicnation
garlicnation / shards.sh
Last active September 26, 2015 02:51
Example sharded vulcanize
npm install -g git+ssh://[email protected]:PolymerLabs/web-component-shards.git
git clone https://github.com/PolymerElements/paper-button.git
cd paper-button
git checkout sampleShards
bower install
web-component-shards -e index.html -e paper-button.html
cd dist
http-server
# Open up a browser and check out the functional iron-component-page.
function ErrorSwallowingFSResolver(config) {
FSResolver.call(this, config);
}
ErrorSwallowingFSResolver.prototype = Object.create(FSResolver.prototype);
ErrorSwallowingFSResolver.prototype.accept = function(uri, deferred) {
var reject = deferred.reject;
deferred.reject = function(arg) {
deferred.resolve("");
Polymer.Pd = {
properties: {
pressed: {
type: Boolean,
readOnly: !0,
value: !1,
reflectToAttribute: !0,
observer: "_pressedChanged"
},
toggles: {
Polymer.fc = {
properties: {
_elevation: {
type: Number
}
},
observers: ["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)"],
hostAttributes: {
role: "button",
tabindex: "0"
// BowerJSON represents a bower.json file
type BowerJSON struct {
Dependencies *map[string]string `json:"dependencies, omitempty"`
DevDependencies *map[string]string `json:"devDependencies, omitempty"`
}
// findBodyElements returns a document fragment containing
// all elements that should be moved into body from a document-order
// array of elements in head, searching from startIndex to endIndex
function findBodyElements(flatHead, startIndex, endIndex) {
if (endIndex === -1) {
endIndex = flatHead.length;
}
var container = dom5.constructors.fragment();
for (var headidx = start, el; headidx < endIndex; headidx++) {
el = flatHead[headidx];