A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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
// Copyright (c) 2019 Weihang Jian <[email protected]> | |
export default async (src, dest) => { | |
const exif = await retrieveExif(src); | |
return new Blob([dest.slice(0, 2), exif, dest.slice(2)], { | |
type: "image/jpeg" | |
}); | |
}; | |
export const SOS = 0xffda, |
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 ThumbnailGenerator() { | |
this.resizeCanvas = document.createElement('canvas'); | |
this.generate = function (imgSrc, thumbDims, compression) { | |
[this.resizeCanvas.width, this.resizeCanvas.height] = [thumbDims.x, thumbDims.y]; | |
const ctx = this.resizeCanvas.getContext("2d"); | |
const tmp = new Image(); | |
const ret = new Promise(resolve => { |
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
// const Buffer = require('buffer/').Buffer; | |
import { Injectable } from '@angular/core'; | |
// Ported to browser from https://githuBuffer.com/joeferner/node-bplist-parser/blob/master/bplistParser.js | |
// Inspired by http://code.google.com/p/plist/source/browse/trunk/src/com/dd/plist/BinaryPropertyListParser.java | |
const bigInt = require('big-integer'); | |
const Buffer = require('bops'); | |
export const maxObjectSize = 100 * 1000 * 1000; // 100Meg | |
export const maxObjectCount = 32768; |
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
/** | |
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). | |
* (c) Chris Veness MIT Licence | |
* | |
* @param {String} plaintext - Plaintext to be encrypted. | |
* @param {String} password - Password to use to encrypt plaintext. | |
* @returns {String} Encrypted ciphertext. | |
* | |
* @example | |
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); |
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
/* | |
Goal : instantly play any wav source without download the file and without <audio/> | |
Idea is to use the fetch streaming API and pass raw data to web audio | |
My use case is playng a wav file | |
following http://stackoverflow.com/questions/38589614/webaudio-streaming-with-fetch-domexception-unable-to-decode-audio-data/38593356#38593356 |
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
'use strict'; | |
// The purpose of this example is to show | |
// how you can block the event loop with JavaScript. | |
// There is 3 routes | |
// / respond with Hello, World text | |
// /block uses JavaScript while for 5 seconds | |
// /non-block uses setTimeout for 5 seconds | |
// Do the following |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
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
<!-- MIT License --> | |
<html> | |
<head> | |
<script> | |
function generateKey(alg, scope) { | |
return new Promise(function(resolve) { | |
var genkey = crypto.subtle.generateKey(alg, true, scope) | |
genkey.then(function (pair) { | |
resolve(pair) | |
}) |
I've heard this before:
What I really get frustrated by is that I cannot wrap
console.*
and preserve line numbers
We enabled this in Chrome DevTools via blackboxing a bit ago.
If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.
NewerOlder