Skip to content

Instantly share code, notes, and snippets.

View vpusher's full-sized avatar
🏔️

Flow vpusher

🏔️
View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>BEFORE PROMOTE</title>
<style type="text/css">
/* -------------------------------------
GLOBAL
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>BEFORE PROMOTE</title>
<style type="text/css">
/* -------------------------------------
GLOBAL
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>BEFORE PROMOTE</title>
<style type="text/css">
/* -------------------------------------
GLOBAL
@vpusher
vpusher / paper-tree-demo.html
Created November 13, 2016 14:57
paper tree demo with bound property
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/paper-tree/paper-tree.html" />
</head>
<body>
<template id="t" is="dom-bind">
<h3>GOT Tree: {{selected.data.name}}</h3>
@vpusher
vpusher / Promise.js
Last active July 25, 2018 04:42
Promise API extension to resolve them sequentially.
// Promise API extension to be able to resolve them sequentially.
Promise.serial = function (promises) {
return promises.reduce((promiseChain, currentPromise) => {
return promiseChain.then(chainResults =>
// Using Promise.resolve() to be able to take any kind of 'promises' parameter: Promise, Function, Object, ...
Promise.resolve().then(currentPromise).then(currentResult =>
[ ...chainResults, currentResult ]
)
);
}, Promise.resolve([]))
@vpusher
vpusher / stats.js
Last active December 3, 2018 09:39
function computeStats(table, betMin = 0, betMax = 1000) {
let rows = Array.prototype.slice.call(table.rows);
let winCount = 0;
let total = 0;
rows.forEach((row) => {
if (row.cells.length === 9) {
// Gather unread messages since the last date.
var unreads = models.filter { message in
return message.model.createdDate?.isAfterDate(date, granularity: .second) ?? false
}
// Among unread messages, drops those sent by me since they are known by the current user.
unreads = Array(unreads.drop(while: { message in
return message.model.isMe
}))
import {enigma, sha1} from 'sway-labs/ciphers';
import {Injector} from 'sway-labs/strings/utils';
import {OCR} from 'sway-labs/vision';
/**
* Overcomplicated decoding function returning the answer of the challenge.
* @param {string} input Some encrypted string.
* @returns {Promise<string>} Possibly the decrypted answer to this non-sense.
*/
async function decode(input: string): Promise<string> {