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 / mothereffingconsolelog.js
Created March 12, 2014 23:41
mothereffingconsolelog.js
(function(){
var log = console.log;
console.log = function(str) {
var css = 'text-shadow: -1px -1px hsl(0,100%,50%), 1px 1px hsl(5.4, 100%, 50%), 3px 2px hsl(10.8, 100%, 50%), 5px 3px hsl(16.2, 100%, 50%), 7px 4px hsl(21.6, 100%, 50%), 9px 5px hsl(27, 100%, 50%), 11px 6px hsl(32.4, 100%, 50%), 13px 7px hsl(37.8, 100%, 50%), 14px 8px hsl(43.2, 100%, 50%), 16px 9px hsl(48.6, 100%, 50%), 18px 10px hsl(54, 100%, 50%), 20px 11px hsl(59.4, 100%, 50%), 22px 12px hsl(64.8, 100%, 50%), 23px 13px hsl(70.2, 100%, 50%), 25px 14px hsl(75.6, 100%, 50%), 27px 15px hsl(81, 100%, 50%), 28px 16px hsl(86.4, 100%, 50%), 30px 17px hsl(91.8, 100%, 50%), 32px 18px hsl(97.2, 100%, 50%), 33px 19px hsl(102.6, 100%, 50%), 35px 20px hsl(108, 100%, 50%), 36px 21px hsl(113.4, 100%, 50%), 38px 22px hsl(118.8, 100%, 50%), 39px 23px hsl(124.2, 100%, 50%), 41px 24px hsl(129.6, 100%, 50%), 42px 25px hsl(135, 100%, 50%), 43px 26px hsl(140.4, 100%, 50%), 45px 27px hsl(145.8, 100%, 50%), 46px 28px hsl(151.2, 100%, 50%), 47px 29px hsl(156.6, 100
@addyosmani
addyosmani / music.md
Last active January 4, 2016 22:09
music.js - Music recommendations by JavaScripters. Because, reasons :)
@addyosmani
addyosmani / Gruntfile_1.js
Last active August 9, 2016 14:26
Gulp comparison examples
module.exports = function(grunt) {
grunt.initConfig({
concat: {
'dist/all.js': ['src/*.js']
},
uglify: {
'dist/all.min.js': ['dist/all.js']
},
jshint: {
files: ['gruntfile.js', 'src/*.js']
@addyosmani
addyosmani / juststuff.md
Last active December 31, 2015 23:19
Modular Yeoman generator exercise
@addyosmani
addyosmani / output.md
Created December 15, 2013 18:39
output.md
addyo at addyo-macbookair3 in ~/projects/testy
$ yo webapp

     _-----_
    |       |
    |--(o)--|   .--------------------------.
   `---------´  |    Welcome to Yeoman,    |
    ( _´U`_ )   |   ladies and gentlemen!  |
    /___A___\   '__________________________'
@addyosmani
addyosmani / thoughts.md
Last active December 28, 2015 20:49
Musings on Yeoman.next

Yo.next stream of thought

We currently have an on-going design doc walking through our ideal implementation of Yeoman.next - a system of easily composable generators. Given the complexity of that task, we're likely going to need to break that proposal down into several sub-specs/tasks that we gradually introduce as generator system features. This gist is to mostly collect ideas that define how yo.next generators differ from what we have today.

The hope is that definitions will provide us some guidance when it comes to actually prototyping this system.

@addyosmani
addyosmani / examples.md
Last active February 23, 2016 18:22
Object.observe() examples from my talk

What are we trying to observe? Raw object data.

// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
 
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
@addyosmani
addyosmani / lesser.md
Created October 1, 2013 11:36
Lesser known Yeoman generators

yo bootstrap

Add Bootstrap to your project with choices including CSS, Sass, Less or Stylus.

Install: npm install generator-bootstrap -g

Usage:

$ yo bootstrap
@addyosmani
addyosmani / recog.js
Created September 20, 2013 17:34
DevTools speech recognition
r = new webkitSpeechRecognition;
r.continuous = true;
r.interimResults = true;
r.onresult = function(ev) {
console.log(ev.results[ev.results.length-1][0].transcript);
};
r.start()
@addyosmani
addyosmani / a thing.md
Last active December 22, 2015 01:19
Just a thing

Large-scale JS application architecture with web components

I once wrote about implementing your own decoupled architecture for building large-scale apps, inspired by some of the work Nicolas Zakas did at Yahoo and I at AOL.

It included suggestions such as breaking down your app into small, highly-reusable components which were easier to maintain. These components would communicate (or react) to each each other by means of an event messaging bus or mediator. A permission model would ensure that components could only speak to parts of the system they were allowed to and facade patterns (abstraction APIs) let you switch out one utility library for another as needed.

A few years have passed since then and luckily standards-based web platform primitives started to appear to help with a similar set of problems. To say that this has been exciting to see evolve would be an under-statement.

Enter stage left, Web Components