Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am qwtel on github.
  • I am qwtel (https://keybase.io/qwtel) on keybase.
  • I have a public key ASCbFur24236CAj1oGXKHjjTVGaT35JcTLQNXvXUFG7aOwo

To claim this, I am signing this object:

@qwtel
qwtel / sigV4Client.js
Last active February 20, 2019 17:31
/*
* Copyright (c) 2018 Florian Klampfer <https://qwtel.com/>
*
* This software uses portions of `sigV4Client.js`,
* which is Apache-2.0 licensed with the following copyright:
*
* > Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Changes:
* * Replaced "crypto-js" with Web Cryptography API
@qwtel
qwtel / createTween.js
Last active November 6, 2018 18:18
rxjs5 tweening helper function. Creates a tween observable that emits samples from an easing function via requestAnimationFrame.
import { Observable } from 'rxjs/Observable';
/**
* Creates an observable that emits samples from an easing function on every animation frame
* for a duration `d` ms.
*
* The first emitted value will be a sample form the easing function at `t = 0`,
* and the last emitted value is guaranteed to be the easing function at `t = d`.
*
* It can be used with any of [Robert Penner's easing functions](http://robertpenner.com/easing/),
function fetchRx(url, options) {
const controller = new AbortController();
const { signal } = controller;
return Observable.create(observer => {
fetch(url, { signal, ...options })
.then(x => observer.next(x))
.catch(x => observer.error(x))
.finally(() => observer.complete())
return () => controller.abort();
});
@qwtel
qwtel / ethpyramid.sol
Created January 30, 2016 16:31
ETH Pyramid Contract
contract Pyramid {
struct Participant {
bytes desc;
address etherAddress;
bytes bitcoinAddress;
}
Participant[] public participants;
uint public payoutIdx = 0;
Atom Sync Settings Backup
@qwtel
qwtel / jsx-create-element.js
Last active December 6, 2017 10:27
Patches the default document.createElement function to follow the JSX/React.createElement function signature.
var createElement = document.createElement.bind(document);
function appendChild(child) {
this.appendChild(
child instanceof Element ? child : document.createTextNode(child)
);
}
document.createElement = function(tagName, attrs, children) {
var el = createElement(tagName);
<!-- This is an exemplary mailchimp subscription form -->
<div id="mc_embed_signup">
<form action="{{ site.mailchimp.action }}" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h2>Subscribe to our mailing list</h2>
<div class="mc-field-group form-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span></label>
<input type="email" value="" name="EMAIL" class="form-control required email" id="mce-EMAIL">
<small class="indicates-required form-text text-muted"><span class="asterisk">*</span> indicates required</small>
</div>
@qwtel
qwtel / quick-and-dirty-set.js
Created October 13, 2017 14:39
Quick-and-Dirty `Set` implementation
// Quick-and-Dirty `Set` implementation.
/* eslint-disable */
export const Set = global.Set || function (a = []) {
a = a.filter((x, i) => i === a.indexOf(x));
a.size = a.length;
a.has = x => a.indexOf(x) > -1;
a.add = x => { if (!a.has(x)) { a.size++; a.push(x); } return a; };
a.delete = x => { let t; if (t = a.has(x)) { a.size--; delete a[a.indexOf(x)]; } return t; };
a.keys = a.values = () => a[Symbol.iterator]();
a.clear = () => { while (a.pop()) {} a.size = 0; };
@qwtel
qwtel / test.md
Last active September 17, 2017 11:56