Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
/** | |
* @file 为一个组件提供初始化时异步获取数据的能力 | |
* @author zhanglili | |
*/ | |
import {PureComponent, createElement} from 'react'; | |
import {zipObject, identity, noop} from 'lodash'; | |
import {wrapDisplayName} from 'recompose'; | |
/** |
console.log(1); | |
(_ => console.log(2))(); | |
eval('console.log(3);'); | |
console.log.call(null, 4); | |
console.log.apply(null, [5]); | |
new Function('console.log(6)')(); | |
Reflect.apply(console.log, null, [7]) | |
Reflect.construct(function(){console.log(8)}, []); | |
Function.prototype.apply.call(console.log, null, [9]); | |
Function.prototype.call.call(console.log, null, 10); |
This is a working example on how to store CryptoKey
s locally in your browser. We are able to save the objects, without serializing them. This means we can keep them not exportable (which might be more secure?? not sure what attack vectors this prevents).
To try out this example, first make sure you are in a browser that has support for async...await
and indexedDB (latest chrome canary with chrome://flags
"Enable Experimental Javascript" works). Load some page and copy and paste this code into the console. Then call encryptDataSaveKey()
. This will create a private/public key pair and encrypted some random data with the private key. Then save both of them. Now reload the page, copy in the code, and run loadKeyDecryptData()
. It will load the keys and encrypted data and decrypt it. You should see the same data logged both times.
用例子讲解 RxJS 5 的 Operators 。
quicksort :: (Ord a) => [a] -> [a] | |
quicksort [] = [] | |
quicksort (x:xs) = | |
let smallerSorted = quicksort (filter (<=x) xs) | |
biggerSorted = quicksort (filter (>x) xs) | |
in smallerSorted ++ [x] ++ biggerSorted |
<!-- 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) | |
}) |
Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets
“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important
or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”
You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?
<!-- Code snippet --> | |
<div class="form-group"> | |
<div class="col-md-12 text-center"> | |
<span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> | |
</div> | |
</div> |