Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Addy Osmani addyosmani

🎯
Focusing
View GitHub Profile
@peterc
peterc / domains.txt
Created Aug 20, 2013
Most linked domains from 4004 links in JavaScript Weekly from issue #1 through #143
View domains.txt
"github.com" => 551,
"youtube.com" => 84,
"blog.jquery.com" => 60,
"blog.nodejs.org" => 50,
"addyosmani.com" => 47,
"net.tutsplus.com" => 45,
"cooperpress.com" => 36,
"vimeo.com" => 28,
"2ality.com" => 28,
"dailyjs.com" => 25,
@Integralist
Integralist / Description.md
Last active Apr 25, 2020
This is how BBC News currently implements it's Image Enhancer for responsive images. Note: this is a completely rebuilt version of the code so the BBC's original source code doesn't actually look anything like the below example.
View Description.md

The BBC has a server-side image service which provides developers with multiple sized versions of any image they request. It works in a similar fashion to http://placehold.it/ but it also handles the image ratios returned (where as placehold.it doesn't).

The original BBC News process (and my re-working of the script) follows roughly these steps...

  • Create new instance of ImageEnhancer
  • Change any divs within the page (which have a class of delayed-image-load) into a transparent GIF using a Base64 encoded string.
    • We set the width & height HTML attributes of the image to the required size
    • We know what size the image needs to be because each div has custom data-attr set server-side to the size of the image
    • We then set a class of image-replace onto each newly created transparent image
  • We use a 250ms setTimeout to unblock the UI thread and which calls a function resizeImages which enhances the image-replace images so their source is now set to a URL whe
@mikemurray
mikemurray / Gruntfile.js
Created Jul 26, 2013
Gruntfile for PHP and LESS with livereloading
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
php: {
dev: {
options: {
hostname: '127.0.0.1',
@mklabs
mklabs / Gruntfile.js
Last active Dec 10, 2015
A simple example of using yeoman on an express app
View Gruntfile.js
module.exports = function(grunt) {
function noop() {}
grunt.initConfig({
watch: {
reload: {
files: ['public/**', 'views/**'],
tasks: 'reload'
}
@tbranyen
tbranyen / backbone.cacheit.js
Created Oct 25, 2012
Cache Backbone Model and Collection fetch calls with a deferred, simple and intuitive.
View backbone.cacheit.js
/*!
* backbone.cacheit.js v0.1.0
* Copyright 2012, Tim Branyen (@tbranyen)
* backbone.cacheit.js may be freely distributed under the MIT license.
*/
(function(window) {
"use strict";
// Localize global dependency references.
@pete-otaqui
pete-otaqui / css-onload.js
Created Oct 18, 2012
Load External Domain CSS, and get a Callback in IE7, IE8, IE9, FF, Chrome & Safari
View css-onload.js
function cssLoad(url, callback) {
var promise,
resolutions = [],
rejections = [],
resolved = false,
rejected = false,
count, id;
View backbone-tutorial.md

Backbone.js and yeoman

description

this is a list tutorials for building web application using backbone.js and yeoman. We are building a Photo Gallery JS App from Backbone Fundamentals

Requirements

@afabbro
afabbro / webkit-pseudo-elements.md
Created Sep 21, 2012
Webkit Pseudo-Element Selectors (Shadow DOM Elements)
View webkit-pseudo-elements.md

An ongoing project to catalogue all of these sneaky, hidden, bleeding edge selectors as I prepare my JSConf EU 2012 talk.

Everything is broken up by tag, but within each the selectors aren't particularly ordered.

I have not tested/verified all of these. Have I missed some or got it wrong? Let me know. - A

A friendly reminder that you may need to set this property on your target/selected element to get the styling results you want:

-webkit-appearance:none;

@zegilooo
zegilooo / backbone.localCache.js
Created Jul 23, 2012 — forked from lukecanvin/backbone.localCache.js
Online/offline syncing for Backbone
View backbone.localCache.js
Backbone.serverSync = Backbone.sync;
Backbone.pingUrl = '/Ping';
Backbone.localID = function() {
var localID = (localStorage.localID ? parseInt(localStorage.localID) : 0);
localID++;
localStorage.localID = localID.toString()
return -localID;
}
@sindresorhus
sindresorhus / LICENSE.txt
Created Jun 4, 2012 — forked from 140bytes/LICENSE.txt
Photo Booth (140byt.es)
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.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
You can’t perform that action at this time.