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 / 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 / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@addyosmani
addyosmani / demo.js
Last active April 1, 2024 09:19 — forked from itsjavi/scriptloader.js
Simple promise-based script-loader
const loader = new loadScript();
loader.load([
'//apis.google.com/js/client:platform.js?onload=startApp',
'//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.10.3/dropbox.min.js'
]).then(({length}) => {
console.log(`${length} scripts loaded!`);
});
@addyosmani
addyosmani / functional-utils.js
Created January 7, 2018 20:32 — forked from bendc/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// Examples at https://gist.github.com/bendc/9b05735dfa6966859025#gistcomment-1370485
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
@addyosmani
addyosmani / docs.md
Created March 9, 2012 21:11 — forked from peol/docs.md
basket.js docs

##basket.js 0.2

###Introduction

basket.js is a small JavaScript library supporting localStorage caching of scripts. If script(s) have previously been saved locally, they will simply be loaded and injected into the current document. If not, they will be XHR'd in for use right away, but cached so that no additional loads are required in the future.

###Why localStorage?

Tests by Bing and Google have shown that there are performance benefits to caching assets in localStorage (especially on mobile) when compared to simply reading and writing from the standard browser cache. This project is currently working on replicating these tests in the public so that we have definitive statistics on whether this is true.

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.

#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
@addyosmani
addyosmani / app.yaml
Created December 2, 2015 10:10 — forked from dustintheweb/app.yaml
Google App Engine (Python) - app.yaml for hosting a static site
application: your-app-name
version: 1
runtime: python27
api_version: 1
threadsafe: true
default_expiration: "30d"
handlers:
# web files
@addyosmani
addyosmani / throttling.sh
Last active October 23, 2016 10:43 — forked from arrel/Throttling
Throttle bandwidth to individual domains on os x
#!/bin/bash
# if you do not have access to run the script, run "chmod 755 throttling"
# to run enter in terminal "./throttling [speed]"
# full (no throttling)
# fast (3000Kbit)
# medium (100Kbit)
# slow (10Kbit)
# wwdc (1Kbit)
# off (blocks connection)
@addyosmani
addyosmani / Gruntfile.js
Last active September 27, 2016 09:36 — forked from mklabs/Gruntfile.js
module.exports = function(grunt) {
function noop() {}
grunt.initConfig({
watch: {
reload: {
files: ['public/**', 'views/**'],
tasks: 'reload'
}
},