This file contains hidden or 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
# frozen_string_literal: true | |
require 'redis' | |
class Handler | |
DB = Redis.new | |
def initialize(headers, client) | |
@headers = headers | |
@client = client | |
end |
This file contains hidden or 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
# frozen_string_literal: true | |
require 'redis' | |
class Handler | |
DB = Redis.new | |
def initialize(client, request, db) | |
@client = client | |
@request = request | |
end |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<body> | |
<a id="link" v-on:click="clickEvent" href="#">A</a> | |
<script src="bundle.js"/> | |
</body> | |
</html> |
This file contains hidden or 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
// *.pem files were generated with: | |
// openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 | |
const http = require('http') | |
const https = require('https') | |
const fs = require('fs') | |
http.createServer((req, res) => { | |
res.writeHead(301, { Location: `https://localhost${req.url}` }) | |
res.end() |
This file contains hidden or 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
/** | |
* Calculates weighted average with latter values weighing more. | |
* | |
* Weights for each value are calculated using https://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Exponentially_decreasing_weights | |
* | |
* The average itself is calculated by summing up each value multiplied by its weight: https://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Convex_combination_example | |
* | |
* @param {number|Array<number>} values Values, of which to calculate average | |
* @param {number} delta Delta, 0 < delta < 1, basically, how much weight the latest value will have when calculating average | |
* @return The input multiplied by 2. |