Skip to content

Instantly share code, notes, and snippets.

View AndreaHasani's full-sized avatar

AndreaH AndreaHasani

View GitHub Profile
function scrollIt(destination, duration = 200, easing = 'linear', callback) {
const easings = {
linear(t) {
return t;
},
easeInQuad(t) {
return t * t;
},
easeOutQuad(t) {
@AndreaHasani
AndreaHasani / style.css
Last active August 24, 2019 14:41
style.css
.multi-label--accordion-content-tip-body {
color: #4a4a4a;
font-size: 12px;
margin-bottom: 20px;
margin-top: 0;
}
.multi-label {
margin-bottom: 20px;
}
.multi-label--tabs.tabs {
@AndreaHasani
AndreaHasani / leaky_bucket.py
Created August 4, 2020 13:47
Async Leaky Bucket Algo
class AsyncLeakyBucket(base):
"""A leaky bucket rate limiter.
Allows up to max_rate / time_period acquisitions before blocking.
time_period is measured in seconds; the default is 60.
rate_sec: Rate which the message should be allowed after limit
"""
@AndreaHasani
AndreaHasani / script.js
Created March 26, 2024 23:08
Google-search-url-redirect
// @license GPL-2.0-only
!function() {
"use strict";
let rules = [
{
matchRegex: RegExp(/^(?:.*?(?:\/RU=|&q=|&as=))?https?:\/\/((?!test)[a-z]+)\.?m?\.wikipedia\.org\/(?:[a-z]+|wiki)\/(?!Special:Search)(.*?)(?:$|\/RK=.*|&sa=.*)/),
replaceWith: "https://www.wikiwand.com/$1/$2"
},
{