











gapi.client.load('urlshortener','v1',function(){});
fromapiclient.discovery import build service =build('urlshortener','v1')
...And on the server side:
Google Cloud End Points:
bit.ly/gce-web - Full Tutorial
Endpoints Proto Datastore API
navigator.onLine & window.(ononline|onoffline)
display:
and
display:
display:
That's all great...
.box {
display: ;
: ;
: ;
}
.box {
: ;
}
.box > :nth-child(2) {
: ;
}
Example: distribute toolbar icons evenly as device width changes:
.box > * {
: 1 0 0px;
}
.box > :nth-child(2) {
: px;
}

calc()
width: (200px - 100); width: (2 * 50%); width: (200px / 2); color: hsl((120), (75%), 0.5); background-position: (50% + 5px) center;
min()
width: (150px, 100px, 200px); width: (90px + 50px, 100px); width: (100px, 100%); /* where 100% is 200px; */
max()
width: (150px, 100px, 200px); width: (200px - 50px, 100px); width: (100px, 100%); /* where 100% is 200px; */
.circle {
width: 300px;
height: 300px;
}
div {
display: ;
width: (100% - 4em);
height: (100% - 4em);
border-radius: 50%;
: center;
: center;
}
div:hover {
border-radius: 0;
}

cross-fade()
background-image: (url(first.png), url(second.png), 50%);
@-webkit-keyframes fading {
0% { background-image: (url(first.png), url(second.png), 0%); }
100% { background-image: (url(first.png), url(second.png), 100%); }
}
Apply filter effects to any DOM element:
video, img {
: grayscale(0.5) blur(10px);
}
--enable-accelerated
flag for hardware accelerated content.
Angular ( angularjs.org ) example:
<div ng-app ng-init="val=25">
Volume: <input type="range" min="0" max="100" ng-model="val">
{{val}}/100
</div>
data-*
Attributes
attr()
to get the value(s)
:before
/
:after
pseudo elements
<style>
input::after {
content: attr(data-value) '/' attr(max);
position: relative;
left: 135px; top: -20px;
}
</style>
<input type="range" min="0" max="100" value="25">
<script>
var input = document.querySelector('input');
input.dataset.value = input.value; // Set an initial value.
input.addEventListener('change', function(e) {
this.dataset.value = this.value;
});
</script>
Browsers: <input list="browsers"> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> <option value="Internet Explorer"> <option value="Opera"> <option value="Safari"> </datalist>
list
attribute "binds" data list to an <input>
Browsers:
data-*
attrs /
<datalist>

function startWorker(settings) {
var myWorker = new Worker('scripts/worker.js');
myWorker.addEventListener("message", workerListener, false);
myWorker.postMessage(settings);
}
self.addEventListener('message', function(e) {
doSomeWork();
};
function doSomeWork() {
importScripts('http://url?callBack=handleWork');
}
function handleWork() {
postMessage(result);
}
Opening a filesystem:
window.( TEMPORARY, // persistent vs. temporary storage 1024 * 1024, // size (bytes) of needed space initFs, // success callback opt_errorHandler // opt. error callback, denial of access );
filesystem:
) URL:
filesystem:http://example.com/temporary/image.png
var img = document.createElement('img');
img.src = fileEntry.toURL();
document.body.appendChild(img);
FileEntry
from its
filesystem:
URL:
window.(img.src, function(fileEntry) { ... });
Wrapper lib that implements common UNIX cmds (ls, cp, mv)
var filer = new Filer();
filer.init({persistent: false, size: 1024 * 1024}, function(fs) {...}, onError);
filer.ls('path/to/some/dir/', function(entries) { ... }, onError);
filer.cp('file.txt', '/path/to/folder', 'newname.txt', function(entry) {
// entry.fullPath == '/path/to/folder/newname.txt'
}, onError);
var b = new Blob(['body { color: red; }'], {type: 'text/css'});
filer.write('styles.css', {data: b, type: b.type}, function(entry, writer) {
...
}, onError);

postMessage()
3. Complex types (
File
,
Blob
,
ArrayBuffer
) via structured cloning
var data = [1, 2, 3, 4];
// Blob() in Chrome 20, FF 13
worker.postMessage(new Blob(data.toString(), {type: 'text/plain'}));
var uint8Array = new Uint8Array(data);
worker.postMessage(uint8Array);
worker.postMessage(uint8Array.buffer);
Same old friend, different semantics (note the vendor prefix):
worker.(arrayBuffer, [arrayBuffer]); window.(arrayBuffer, targetOrigin, [arrayBuffer]);
ArrayBuffer
) is transferred to new context (e.g. worker/window). Source buffer becomes unavailable.
var uint8Array = new Uint8Array(1024 * 1024 * 32); // 32MB
// Fill'r up!
for (var i = 0, len = uint8Array.length; i < len; ++i) {
uint8Array[i] = i;
}
worker.(uint8Array, [uint8Array.buffer]);
Pass multiple buffers at once and/or additional data:
worker.({
view1: uInt8Array,
buffer2: anotherBuffer,
username: 'johndoe'
}, [uInt8Array.buffer, anotherBuffer]);
.byteLength
goes to zero.
var ab = new ArrayBuffer(1);
worker.(ab, [ab]);
if (ab.byteLength) {
alert('Transferables are not supported in your browser!');
} else {
// Transferables are supported.
// PITA = pain in the...
}

Device APIs WG: www.w3.org/2009/dap/
navigator.onLine
/
navigator.connection
( network connectivity )
<input type="text" x-webkit-speech>
Plugin-free acess to camera/microphone.
navigator.({audio: true, video: true}, function(stream) {
var video = document.querySelector('video');
video.src = window.(stream);
}, function(e) {
console.log(e);
});
<video autoplay controls></video>
<input type="button" value="⚫" onclick="record(this)"> <input type="button" value="◼" onclick="stop(this)">
var localMediaStream, recorder;
var record = function(button) {
recorder = localMediaStream.record();
};
var stop = function(button) {
localMediaStream.stop();
recorder.getRecordedData(function(blob) {
// Upload blob using XHR2.
});
};
getUserMedia()

File
,
Blob
, or
ArrayBuffer
types.
var socket = new WebSocket('ws://example.com/sock', ['dumby-protocol']);
socket.binaryType = 'blob'; // or 'arraybuffer'
socket.onopen = function(e) {
window.setInterval(function() {
if (socket.bufferedAmount == 0) {
socket.send(new Blob([blob1, blob2]));
}
}, 50); // rate limit us.
};
socket.onmessage = function(e) {
document.querySelector('img').src = (e.data);
};

Meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
Header:
X-UA-Compatible: IE=Edge,chrome=1
Is What You Make Out Of It

Source: github.com/greenido/