Skip to content

Instantly share code, notes, and snippets.

@fluxsaas
fluxsaas / webhooks.txt
Created October 14, 2013 12:09
Fastbill Automatic Webhooks
mögliche Notifications:
-----------------------
- subscription.created
- subscription.changed
- subscription.canceled
@vectorsize
vectorsize / linearScale.js
Last active December 20, 2022 14:30
Quick linear scale inspired by d3.js scales, based on the processing.org map() function.takes in an object with a domain array and a rage array, gives you back a function that receives a value and returns the scaled value.
// based on https://github.com/processing/processing/blob/a6e0e227a948e7e2dc042c04504d6f5b8cf0c1a6/core/src/processing/core/PApplet.java#L5093
var scale = function(opts){
var istart = opts.domain[0],
istop = opts.domain[1],
ostart = opts.range[0],
ostop = opts.range[1];
return function scale(value) {
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
@renchap
renchap / README.md
Last active October 12, 2022 17:14
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@paul-em
paul-em / tiny-equals.js
Last active May 16, 2023 23:43
deep equals method for comparing variables including objects
/**
*
* This will deep check two variables including objects
* It works in IE9+
* Note: equals(NaN, NaN) uses js default behaviour: false
*
* equals(1, 1) --> true
* equals(1, 2) --> false
*
* equals({a: 1}, {a: 1}) --> true
/**
*
* This will deep check two variables including objects
* Note: equals(NaN, NaN) uses js default behaviour: false
*
* equals(1, 1) --> true
* equals(1, 2) --> false
*
* equals({a: 1}, {a: 1}) --> true