Skip to content

Instantly share code, notes, and snippets.

View omo's full-sized avatar

Hajime Morrita omo

  • Mountain View, CA
View GitHub Profile
@omo
omo / gist:9986103
Created April 5, 2014 01:08
HTML Imports: Discussion over Async/Progressive Loading

HTML Imports: Discussion over Async/Progressive Loading

There are concerns around HTML Imports that does sync or blocking loading as the default. I’d like to address these concerns. Especially I’d like to understand the actual use cases that “sync” loading hurts. This document aims to be a portal of that effort.

What to Block

Before discussing use cases, let’s clarify which part of page loading process HTML Imports possibly blocks. The blocking model of HTML Imports is modeled after the one for external stylesheets. There are two main bits of the blocking:

The <script> elements

<!DOCTYPE>
<script>
window.Document.prototype.hello = function() {
alert("Hello!");
}
</script>
<h1>Call document.hello() for me.</h1>
# -*- coding: utf-8 -*-
import os
import json
import urllib
import urllib2
import requests
URL = "https://api.github.com/gists"
#PADDING_SIZE = 1024 # This works
@omo
omo / profilers.html
Created July 16, 2013 03:14
This demonstrates how to use window.internals.profilers API.
<!HTML>
<html>
<head></head>
<body>
<script>
function parseProfileHeader(text)
{
return parseInt(text.match(/(\d+) \[/)[1]);
}
@omo
omo / gist:5553547
Last active December 17, 2015 04:49
#0 0x0000555559529d6c in WebCore::wrap (impl=0x2ebf9c071620, creationContext=..., isolate=0x7ffff7e62020) at gen/webkit/bindings/V8DocumentFragment.h:72
#1 0x0000555559a8fdac in WebCore::wrap (impl=0x2ebf9c071620, creationContext=..., isolate=0x7ffff7e62020) at ../../third_party/WebKit/Source/bindings/v8/custom/V8NodeCustom.cpp:152
#2 0x00005555594cde8f in WebCore::toV8 (impl=0x2ebf9c071620, creationContext=..., isolate=0x7ffff7e62020) at gen/webkit/bindings/V8Node.h:75
#3 0x0000555559a706a1 in WebCore::toV8 (impl=0x2ebf9c071620, creationContext=..., isolate=0x7ffff7e62020) at ../../third_party/WebKit/Source/bindings/v8/custom/V8EventTargetCustom.cpp:50
#4 0x0000555559b220bc in WebCore::V8AbstractEventListener::getReceiverObject (this=0x2ebf9b177f50, context=0x2ebf9b3390c8, event=0x2ebf9ba3ed60) at ../../third_party/WebKit/Source/bindings/v8/V8AbstractEventListener.cpp:186
#5 0x0000555559b23262 in WebCore::V8EventListener::callListenerFunction (this=0x2ebf9b177f50, context=0x2ebf9b3390c8, jsEvent=..., e
@omo
omo / tedmp3.json
Created February 13, 2013 14:35
TED MP3 URLs
{"mp3":["http://video.ted.com/talks/podcast/audio/AdoraSvitak_2010.mp3","http://video.ted.com/talks/podcast/audio/AimeeMullins_2009.mp3","http://video.ted.com/talks/podcast/audio/AlGore_2006.mp3","http://video.ted.com/talks/podcast/audio/AlGore_2008.mp3","http://video.ted.com/talks/podcast/audio/AlGore_2009.mp3","http://video.ted.com/talks/podcast/audio/AlaindeBotton_2009G.mp3","http://video.ted.com/talks/podcast/audio/AlanRussell_2006.mp3","http://video.ted.com/talks/podcast/audio/AlanSiegel_2010.mp3","http://video.ted.com/talks/podcast/audio/AlexSteffen_2005.mp3","http://video.ted.com/talks/podcast/audio/AlexTabarrok_2009.mp3","http://video.ted.com/talks/podcast/audio/AmySmith_2006.mp3","http://video.ted.com/talks/podcast/audio/AmyTan_2008.mp3","http://video.ted.com/talks/podcast/audio/AndrewMwenda_2007G.mp3","http://video.ted.com/talks/podcast/audio/AnilGupta_2009I.mp3","http://video.ted.com/talks/podcast/audio/AnnaDeveareSmith_2005.mp3","http://video.ted.com/talks/podcast/audio/AnthonyAtala_2009P.mp3","ht
@omo
omo / .gitignore
Last active December 11, 2015 09:18
logs
project/project
project/target
target
tmp
.settings
@omo
omo / gist:3888055
Created October 14, 2012 08:50
Build Breakpad for Mac OS (on ML)
# install gyp.
$ git clone http://git.chromium.org/external/gyp.git
# checkout breakpad.
$ svn checkout http://src.chromium.org/svn/trunk/src/breakpad/
$ cd breakpad
$ svn co http://google-breakpad.googlecode.com/svn/trunk/src
$ vi breakpad.gyp # To comment out reference to parent (..) directories.
# generate xcodeproj and build it.
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/SocketServer.py", line 639, in __init__
self.handle()
File "/usr/local/Cellar/python/2.7.2/lib/python2.7/BaseHTTPServer.py", line 343, in handle
self.handle_one_request()
@omo
omo / process.cpp
Created April 8, 2012 11:56
ProcessManager::resume
void ProcessManager::resume(ProcessBase* process)
{
...
// Now service the event.
try {
process->serve(*event);
} catch (const std::exception& e) {
std::cerr << "libprocess: " << process->pid
<< " terminating due to "
<< e.what() << std::endl;