Skip to content

Instantly share code, notes, and snippets.

@fcalderan
fcalderan / Jekyll-base64.md
Last active June 24, 2023 19:39
A Base64 image encoder plugin for JekyllRB

#Jekyll Base64 Encoder A Liquid tag for base64 encoding

Note: this plugin requires Colorize:

gem install colorize
@fcalderan
fcalderan / a11y.css
Last active September 29, 2022 11:03
Angelini, accessibility hints
/* focus visibile */
.site__brand:focus-within,
a:focus {
outline: 3px #FF50AE solid !important;
outline-offset: 2px;
}
/* skip navigazione visibile al focus */
@fcalderan
fcalderan / reset.css
Last active August 5, 2022 15:18 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
#include <Wire.h>
#include <RtcDS3231.h>
#define DELAY_ONPLAY 1000
#define DELAY_ONPAUSE 20000
@fcalderan
fcalderan / inception-javascript.js
Created November 2, 2010 09:42
inception explained as a 4 nested javascript closures
/*
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02
* I had an idea: could Inception movie be explained by a few javascript closures
* and variable resolution scope (just for fun)?
*
* Activate javascript console =)
*/
<script>
console.group("inception movie");
@fcalderan
fcalderan / silhouette-canvas
Created May 2, 2011 07:40
How to silhouette an image using canvas
/* with this snippet you can create a raw silhouette of an image, it works transforming
non-white pixels (with a small tolerance) into black pixels */
<img id="canvassource" src="your-image-300x300.jpg" />
<canvas id="area" width="300" height="300"></canvas>
<script>
window.onload = function() {
var canvas = document.getElementById("area");
var context = canvas.getContext("2d");
#Progetto Richiamo per rondini
---
Costo dei materiali per la realizzazione singolo dispositivo audio
(acqistando il materiale per slot di 4 prototipi)
```
Microcontrollore Esp8266/01 ......... 3,00€
Speaker 3W .......................... 3,50€
@fcalderan
fcalderan / google-showimage.js
Last active June 4, 2018 07:58
Restore "Show image" in google image results
/* Usage:
* when Google image returns some results, before choosing an image just inject
* this code into the JS console and a new button with a direct link to the image
* will appear inside the overlay.
*/
var config = {
attributes: true,
childList: false,
characterData: false,
@fcalderan
fcalderan / rakefile.rb
Last active March 25, 2018 04:30
This code iterates through every .html file contained in a given folder and, for each template found, it looks for every image (<img>) contained (with Nokogiri gem) in the document. Then it dynamically calculates the image size (with fastimage gem) adding the “height” and “width” attributes. Finally it saves the template. Colorize gem is only us…
# Tested on Ruby v.1.9.3 - Author: Fabrizio Calderan, 3.14.2013
#
# Install these gems with
# $> sudo gem install fastimage nokogiri colorize
#
# Then copy this source into a file named “rakefile” and run with
# $> rake
#
require "fastimage"
require "nokogiri"
@fcalderan
fcalderan / 1) tidy-numbers-stmt.txt
Last active March 9, 2018 12:53
An implementation of the problem B - Tidy numbers: Google Code Jam 2017
# Complete statement of the problem
# https://code.google.com/codejam/contest/3264486/dashboard#s=p1
# Tatiana likes to keep things tidy. Her toys are sorted from smallest
# to largest, her pencils are sorted from shortest to longest and her computers
# from oldest to newest. One day, when practicing her counting skills, she
# noticed that some integers, when written in base 10 with no leading zeroes,
# have their digits sorted in non-decreasing order. Some examples of this are 8,
# 123, 555, and 224488. She decided to call these numbers tidy. Numbers that do
# not have this property, like 20, 321, 495 and 999990, are not tidy.