Skip to content

Instantly share code, notes, and snippets.

View fredmaggiowski's full-sized avatar
🔥
on fire

Federico Maggi fredmaggiowski

🔥
on fire
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fredmaggiowski on github.
  • I am fredmaggiowski (https://keybase.io/fredmaggiowski) on keybase.
  • I have a public key ASCtOxWIt4sF-r_yOsMmYts_x2P-ZlEtcW-1-UICMSQu8wo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am FedericoMaggi on github.
* I am fredmaggiowski (https://keybase.io/fredmaggiowski) on keybase.
* I have a public key whose fingerprint is 1920 140A 9579 B5BA 914B 5A03 5432 FBB8 D04F 965E
To claim this, I am signing this object:
@fredmaggiowski
fredmaggiowski / float2rgb.js
Created September 7, 2016 15:19
A basic function to transform a float into a RGB value (from green to red)
function f2R(f) {
var r = 255
var g = 255
var b = 0
var x = Math.abs(f - 0.5);
var i = Math.ceil(600 * (0.5 - x));
// range between green and yellow
if (f < 0.4) {
r = i
@fredmaggiowski
fredmaggiowski / octa.css
Created September 7, 2016 15:21
Octagon HTML/CSS shape
.my-container {
margin-top: 50px;
padding: 20px;
font-size: 18px;
}
.octagon {
display: inline-block;
width: 40px !important;
height: 20px;
@fredmaggiowski
fredmaggiowski / truncate.go
Created October 19, 2016 13:07
An example of string normalisation with truncation and transformation of first letter to uppercase.
package main
import (
"bytes"
"fmt"
"unicode"
)
const MaxLength = 50