Skip to content

Instantly share code, notes, and snippets.

View addyosmani's full-sized avatar
🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<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-menu/core-submenu.html">
<polymer-element name="my-element">
@addyosmani
addyosmani / deep.js
Last active August 29, 2015 14:02
Adding /deep/ to your selectors
/*
This POC sample uses CSS transform which you can install from
https://www.npmjs.org/package/csstransform
Save this to deep.js and just run via node
*/
var css = __dirname + '/vendor/bootstrap.css';
var target = __dirname + '/dist/bootstrap-deep.css';
@addyosmani
addyosmani / LICENSE.txt
Last active April 8, 2024 20:15 — forked from 140bytes/LICENSE.txt
Offline Text Editor in < 140 bytes (115 bytes). Powered by localStorage & contentEditable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@addyosmani
addyosmani / edit.js
Last active August 29, 2015 14:01
Tweet-friendly offline text editor
var d=document,l=localStorage,k='c',q = d.body;q.contentEditable=true;q.innerHTML=l[k];q.onkeyup=function(){l[k]=q.innerHTML;}
@addyosmani
addyosmani / unit_testing.md
Last active July 27, 2020 05:17
Unit Testing Polymer Elements

Deprecated. See https://www.polymer-project.org/articles/unit-testing-elements.html for the latest version.

Unit Testing Polymer Elements

Note: this guide is a work-in-progress and will be added to the Polymer docs when it's ready. We have updated <seed-element> to include unit tests and this guide has been moved to Google docs. Expect a version on the Polymer site before the end of September.

After spending days working on your <super-awesome> Polymer element, you’re finally ready to share it with the rest of the world. You add the code for using it to your demo, iterate on it over time and come back to it one day when..uh oh. The demo broke because something has gone horribly wrong. Suddenly, <super-awesome> isn’t starting to look so great. Now you’re stuck trying to backtrack through your commit log to figure out how you broke the code. You’re not going to have a fun time.

If you’ve been working on the front-end for a while, even if you haven’t really played with Polymer elements before, this s

@addyosmani
addyosmani / array.prototype.fill.js
Last active May 31, 2016 19:16
ES6 Array.prototype.fill() polyfill
if ( ![].fill) {
Array.prototype.fill = function( value ) {
var O = Object( this );
var len = parseInt( O.length, 10 );
var start = arguments[1];
var relativeStart = parseInt( start, 10 ) || 0;
var k = relativeStart < 0
? Math.max( len + relativeStart, 0)
: Math.min( relativeStart, len );
@addyosmani
addyosmani / resources.md
Last active August 29, 2015 14:00
Polymer resources for FITC

Web Components Can Do That?! extras

Thanks a ton for coming down to my talk, folks <33z. Your energy was amazing. This page has a few extra resources for you.

Slides

http://addyosmani.github.io/fitc-wccdt/

@addyosmani
addyosmani / browserify.md
Last active March 28, 2016 02:06
Yeoman + Browserify

Yeoman generators with Browserify

Browserify is a tool that allows us to write node-style modules that compile for use in the browser. Like node, we write our modules in separate files, exporting external methods and properties using the module.exports and exports variables

generator-browserify is a generator with a Browserify setup, offering choices between Gulp or Grunt and Foundation or Bootstrap.

screenshot 2014-04-20 at 10 19 09 pm

generator-angular-with-browserify is a generator for bundling Angular.js with Browserify

@addyosmani
addyosmani / workflow.md
Last active August 29, 2015 13:58
A workflow for creating re-usable Polymer elements

A workflow for creating re-usable Polymer elements

This guide takes you through setting up the boilerplate for working on a re-usable Polymer element. It also covers the tooling to deploy a version of your package such that the master branch of your repository can be easily consumed by other apps or elements (e.g through Bower) and the gh-pages branch can be used for sharing the demo and documentation for your element.

Note: We assume you have git and Bower installed and use Scott Miles' Polymer boilerplate for getting started.

Getting setup

  • Create a new directory on your system for working on Polymer elements (e.g development).
  • Clone the untitled-element boilerplate inside this directory: git clone git://github.com/polymerlabs/untitled-element.git. Rename the element and it's files accordingly. For example, if your element was called test-element, your file list would look a little like this: