Skip to content

Instantly share code, notes, and snippets.

@fcalderan
fcalderan / Slideshow-with-CSS3-Animations.markdown
Last active December 25, 2015 16:19
A Pen by Fabrizio Calderan.

Slideshow with CSS3 Animations

A simple proof-of-concept: a slideshow animation using CSS3 only

See the demo by Fabrizio Calderan.

License.

@fcalderan
fcalderan / ftf.sh
Last active February 25, 2016 10:32
From the Front Early Bird Detector
#!/bin/sh
# set last 2 digits of the current year
year=16
# set terminal title
echo "\033]0;FTF Early Bird Checker\007";
@fcalderan
fcalderan / perftest.sh
Last active March 8, 2017 14:37
A small bash utility for testing slower connection. Use chmod +x perftest.sh to make the script executable. Thanks to Matteo Rosati for sharing basic commands
#!/bin/sh
CMD="$1"
RATE="$2"
DELAY="$3"
if [ "$RATE" = "" ] ; then
RATE=500
fi
if [ "$DELAY" = "" ] ; then
@fcalderan
fcalderan / meteotweet.php
Last active December 5, 2017 23:38
Arduino sketch code and PHP code for H-art tweeting weather station. This projects was tested with an Arduino UNO + ethernet shield + DHT22 sensor.
<?php
function roundNum($n) { return round(10 * $n)/10; }
// Insert your keys/tokens
$consumerKey = '<your-key>';
$consumerSecret = '<your-key>';
$oAuthToken = '<your-key>';
$oAuthSecret = '<your-key>';
@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.
@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 / 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,
#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 / 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");
@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");