Skip to content

Instantly share code, notes, and snippets.

@owlishDeveloper
owlishDeveloper / gist:57f00a86f9841c8cc5bca88735cba2ae
Created July 6, 2020 00:13
Downloads API proposal - Example 2 - separating concerns
class AppDownload {
WebExtension.DownloadItem mExtensionDownload;
// Cancels the download
GeckoResult<Void> cancel() {
// Actually cancel the download
}
GeckoResult<DownloadItemUpdate> notifyExtension() {
// Notifies extension
class AppDownload {
WebExtension.DownloadItem mExtensionDownload;
// Cancels the download
GeckoResult<Void> cancel() {
// Actually cancel the download
// Notifies extension
DownloadItemUpdate update = mExtensionDownload.updateCanceled(true).commit();
DownloadItemUpdate.Builder b = new DownloadItem.Builder(mExtensionDownload, update);
@owlishDeveloper
owlishDeveloper / js-crypto-libraries.md
Created February 11, 2019 19:04 — forked from jo/js-crypto-libraries.md
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

### Keybase proof
I hereby claim:
* I am owlishdeveloper on github.
* I am owlish (https://keybase.io/owlish) on keybase.
* I have a public key ASC8zVh-A-g4FxWrI6qMpimd9u0OEfZAFJ-vyATm92LAcAo
To claim this, I am signing this object:
@owlishDeveloper
owlishDeveloper / routing.tsx
Last active June 3, 2018 02:56
react + redux + react-router + Typescript
import * as React from "react";
import { createStore } from "redux";
import { mount } from "enzyme";
import { MemoryRouter, Route } from "react-router";
import { Provider } from "react-redux";
export const mountContainerWithRouter = (
state: State = empty(),
container: JSX.Element,
pathname: string,
function wrap(string, value=23) {
if (value <= 0)
throw 'wrong number';
if(string.length < value + 1)
return string;
var newArr = [];
for(var i=0; i<Math.floor(string.length/value)+1; i++) {