- Declarative markup: semantic content (eg Twitter), degrades gracefully (what if cached, read offline, in Pocket, etc), ideally not iframe? (eg not YouTube)
- Progressively enhanced: static fallback (eg Twitter, Guardian Video & Comment), ideally feature detection (eg YouTube)
- Controllable lifecycle: plug and play by default, let host optionally control init and context
- Lightweight: minimal impact on bandwidth & mem/cpu (eg Flickr, not Twitter)
- Responsive: fit in parent element
- Addressable: canonical URL for the embedded content, can be linked to as fallback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Reqwest! A general purpose XHR connection manager | |
* (c) Dustin Diaz 2011 | |
* https://github.com/ded/reqwest | |
* license MIT | |
*/ | |
function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(a,b):this[a]=b()}("reqwest",function(){function handleReadyState(a,b,c){return function(){a&&a[readyState]==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{},d;c.Accept=c.Accept||defaultHeaders.accept[b.type]||defaultHeaders.accept["*"],!b.crossOrigin&&!c[requestedWith]&&(c[requestedWith]=defaultHeaders.requestedWith),c[contentType]||(c[contentType]=b.contentType||defaultHeaders.contentType);for(d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d])}function generalCallback(a){lastValue=a}function urlappend(a,b){return a+(/\?/.test(a)?"&":"?")+b}function handleJsonp(a,b,c,d){var e=uniqid++,f=a.jsonpCallback||"callback",g=a.jsonpCallbackName||"reqwest_"+e,h=new RegExp("((^|\\?|&)"+f+")=([^&]+)"),i=d.match(h),j=doc.createElement("script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
/** | |
* Invoke the super method corresponding to the caller (child-)method. | |
* | |
* Typically useful to call super constructors or destructors. | |
* | |
* @param args The arguments object of the caller method. | |
* @param superArguments Optional arguments to call the super method with. | |
* @return The result of calling the super method. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" placeholder="Your Google Music account" size="30" | |
id="gmusic-switcher-account" | |
onkeyup=" | |
(function() { | |
var account = document.getElementById('gmusic-switcher-account').value; | |
var bookmarklet = document.getElementById('gmusic-switcher-bookmarklet'); | |
var hrefTemplate = bookmarklet.getAttribute('data-href'); | |
var email; | |
if (validEmail(account)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var glob = require('../luigi/src/operation/glob'); | |
var bower = require('../luigi/src/operation/bower'); | |
var uglify = require('../luigi/src/operation/uglify')(); | |
var concat = require('../luigi/src/operation/concat')(); | |
var requirejs = require('../luigi/src/operation/requirejs'); | |
var hash = require('../luigi/src/operation/hash')(); | |
var rename = require('../luigi/src/operation/rename'); | |
var less = require('../luigi/src/operation/less'); | |
var lodash = require('../luigi/src/operation/lodash'); | |
var write = require('../luigi/src/operation/write'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Open a URL in Chrome after SSH'ing to the URL's host and setting up a SOCKS proxy. | |
if [ $# -ne 1 ] | |
then | |
echo "usage: browse-with-proxy.sh <URL>" | |
echo | |
echo "Opens the given URL in a browser using an SSH tunnel to the host as a proxy" | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var validate = require('sourcemap-validator'), | |
fs = require('fs'), | |
assert = require('assert'); | |
var compiledSource = process.argv[2]; | |
if (! compiledSource) { | |
console.log("usage: validate.js <compiled-source.js>"); | |
process.exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(win) { | |
function FooBar() { }; | |
function Node() { }; | |
win.darttest = { | |
FooBar: FooBar, | |
Node: Node, | |
getFooBar: function() { | |
return new FooBar(); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@JS('darttest') | |
library darttest; | |
import 'package:js/js.dart'; | |
@JS() | |
external FooBar getFooBar(); | |
@JS() | |
class FooBar { |
Besides the valid concerns @Rich_Harris has raised, another thing to worry about is the way await
makes it very easy to cause asynchronous work to be scheduled sequentially when it could be parallelised (and hence faster).
Consider the following:
import {getDayOfWeek} from './static-dep';
const dish = getDayOfWeek() === 'friday' ? 'fish' : 'chicken';
OlderNewer