Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
const source = new ReadableStream({…}); // As seen above | |
const destination = new WritableStream({…}); // As seen above | |
const transformer = new TransformStream({ | |
transform(chunk, controller) { | |
// Simply increment each bytes | |
const transformed = chunk.map(value => Math.min(value + 1, 255)); | |
// Enqueue the transformed data | |
controller.enqueue(transformed); |
This file contains hidden or 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
// Read a chunk | |
reader.read().then(function process(result) { | |
if (result.done) { | |
return controller.close(); | |
} | |
console.log('Reading', result.value.length, 'bytes'); | |
controller.enqueue(result.value); | |
return reader.read().then(process); // Continue reading |
This file contains hidden or 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
const source = new ReadableStream({…}); // As seen above | |
const destination = new WritableStream({ | |
start(controller) { | |
// Return a promise to signal the construction is asynchronous | |
return new Promise(resolve => { | |
const source = new MediaSource(); | |
// Mark the WritableStream as ready when the source is open | |
source.addEventListener('sourceopen', () => { | |
this.buffer = source.addSourceBuffer('audio/mpeg'); |
This file contains hidden or 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
new ReadableStream({ | |
start(controller) { | |
return fetch('http://…').then(response => { | |
// In browsers supporting Web Streams, Fetch's response's body is a ReadableStream | |
// Otherwise, in order to stream the response you will have to request some bytes ranges manually | |
// Get a reader on the incoming data | |
const reader = response.body.getReader(); | |
// Read a chunk |
This file contains hidden or 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 transitionend; | |
// Test for transitionend event | |
(function() { | |
if (!window.addEventListener) { | |
return; | |
} | |
var div = document.createElement("div"); | |
function handler(e) { |
This file contains hidden or 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
| format | python | php | ruby | javascript | | |
| -------------------------------------------- |:---------------------------:|:-----------------:|:----:| ----------------:| | |
| Internet Message Format (email) | email.parser | ? | ? | ? | | |
| JSON | json | natif (PHP 5.2) | ? | natif (ES5) | | |
| Base64 | base64 | natif (PHP 4) | ? | natif (?) | | |
| Multipurpose Internet Mail Extensions (MIME) | quopri | natif (PHP 5.3) | ? | mime (Node.JS) | | |
| XML | elementtree | libxml (natif) | ? | natif | | |
| XPath | elementtree (partiel) | libxml (natif) | ? | natif | | |
| RDF/XML |
This file contains hidden or 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
# Display file's metadata | |
$ mdls <file> | |
# Firefox (but not Aurora) | |
$ mdfind "kMDItemKind == 'Application' && kMDItemDisplayName == '*Firefox*'" | |
# Firefox Aurora | |
$ mdfind "kMDItemKind == 'Application' && kMDItemDisplayName == '*Aurora*'" | |
# Chrome & Chrome Canary |
This file contains hidden or 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
# Doesn't work :( | |
$ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Applications/MobileSafari.app/MobileSafari -u http://google.fr | |
# Works :) ! | |
$ ios-sim launch /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/S | |
DKs/iPhoneSimulator6.1.sdk/Applications/MobileSafari.app --args -u http://google.fr | |
# But: brew install ios-sim :/ |
This file contains hidden or 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
# Start the virtual machine | |
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> start <VMX file> nogui | |
# -gu: Virtual's machine username | |
# -gp: Virtual's machine password | |
# <VMX file>: ~/Documents/Virtual Machines.localized/IE8.vmwarevm/Windows XP Professionnel.vmx | |
# nogui: Work headless | |
# Launch IE on the virtual machine and go to a given page | |
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> runScriptInGuest <VMX file> -noWait -activeWindow "" "\"C:\Program Files\Internet Explorer\iexplore.exe\" http://google.fr/" |
NewerOlder