Skip to content

Instantly share code, notes, and snippets.

View addyosmani's full-sized avatar
🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
View GitHub Profile
@addyosmani
addyosmani / polymer-messaging.md
Last active May 31, 2017 14:46
Polymer messaging patterns

MDV data binding with published properties

<polymer-element name="my-app">
<template>
  <td-model items="{{items}}"></td-model>
  <polymer-localstorage value="{{items}}"></polymer-localstorage>
  <div>{{items}}</div>
</template>
@addyosmani
addyosmani / sample.html
Last active December 20, 2015 01:19
Aura homepage
<!-- Define a DOM-element with a data-aura-component attribute and Aura will bring it to life on start -->
<div data-aura-component="hello"></div>
<!-- Define as many of these component instances as you wish -->
<div data-aura-component="hello"></div>
<div data-aura-component="goodbye"></div>
<!-- You can also pass options to your component via data-attributes. -->
<div data-aura-component="hello" data-aura-foo="bar" data-aura-other-option="hello again"></div>
@addyosmani
addyosmani / Oo.js
Created July 5, 2013 00:43
O.o() quick example
var records = [];
var obj = {};
var obj2 = {};
function observer(r){
[].push.apply(records, r);
console.log(r);
}
Object.observe(obj, observer); // Begin observing changes
@addyosmani
addyosmani / snippet for someone
Last active February 10, 2019 22:37
Snippet for someone
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/"
# Set the default Content-Type to `text/plain` instead of `application/
# And serve everything as UTF-8 (although not technically correct, this
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTP
}

1hr super challenge

Zero to hero in an hour — how far can you get?

Some of the worlds best open source projects are initally created in < 1 hr. They're inspired, often caffeine, sleep-deprived or just plain crazy-beans fueled ideas that couldn't be done in a day.

The right time, right place (A Friday afternoon) is the perfect time to pump out what could be a life changing project.


So, lets do something interesting: The lazy web 1hr hackaton.

@addyosmani
addyosmani / log.md
Created June 12, 2013 14:53
Yeoman team meeting Wed 12 15:51
2:37 PM  → jreading, revath and stephenplusplus joined  ← frankblizzard left  •  gugahoi → gugahoi_away  
2:46 PM <addyosmani> you can separate your files to be located anywhere you want and just change around the path references for copy
2:46 PM <addyosmani> we just encourage folks to keep them in the root of the templates folder for consistency
2:46 PM <addyosmani> but that's totally up to you at the end of the day
2:50 PM <di9italant> Not sure my workflow will benefit anyone but if I deem it worthy of publishing I will revert to best practice, its more to satisfy my organisational OCD haha
2:50 PM <addyosmani> :)
2:52 PM → hemanth joined ([email protected])
2:52 PM <hemanth> meow!
@addyosmani
addyosmani / proposal.md
Last active December 18, 2015 03:48
Proposal for a mobile-first generator for Yeoman

We want to create a mobile-first scaffolding solution for Yeoman that helps web app developers quickly kickstart projects with sane defaults.

Some of the problems we felt would be useful to address are:

  • Selection of a UI framework with a mobile-first grid system and sane default breakpoints
  • Boilerplate scaffolding of a basic RWD layout so you can just start coding
  • Conditional inclusion of FastClick to avoid touch event delays (where needed)
  • Appcache manifest generation
  • A solution for high DPI images as part of your build process
  • Option 1: Developers always provide highest resolution assets. Build step to resize the image to correct sizes for display densitites and apply correct src-set attribute to the image ``
@addyosmani
addyosmani / cornify.js
Created May 6, 2013 21:12
Add unicorns to everything.
(function(){var d=document,j=d.getElementById('__cornify_nodes'),k=null;var files=['http://cornify.com/js/cornify.js','http://cornify.com/js/cornify_run.js'];if(j){cornify_add();}else{k=d.createElement('div');k.id='__cornify_nodes';d.getElementsByTagName('body')[0].appendChild(k);for(var l=0;l<files.length;l++){j=d.createElement('script');j.src=files[l];k.appendChild(j);}}})();
@addyosmani
addyosmani / captureCalls.js
Created May 6, 2013 20:58
captureCalls.js - captureCalls('document.getElementById') to show a stack trace for document.getElementById on its every call. By NK.
(function() {
/**
* @param {Object|Function|string} object
* @param {string} methodName
*/
window.captureCalls = function captureCalls(object, methodName) {
var path = '';
if (typeof methodName == 'undefined') {
@addyosmani
addyosmani / Readme.md
Created May 6, 2013 20:55 — forked from NV/Readme.md
stopBefore.js

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')