Skip to content

Instantly share code, notes, and snippets.

@fcalderan
fcalderan / ffmpeg.txt
Created June 16, 2015 13:55
Handy FFmpeg commands
# Build ffmpeg on MacOs
# https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX
> brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
# Conversion to WEBM format:
# http://trac.ffmpeg.org/wiki/Encode/VP8
> ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
@fcalderan
fcalderan / pulcino.pio.js
Last active August 29, 2015 14:07 — forked from anonymous/pulcino.pio.js
Javascript generator of “Il pulcino pio” song lyric: http://www.youtube.com/watch?v=juqyzgnbspY
/* JSHint validated - copy into a javascript console and look at the output */
(function(title) {
"use strict";
var lyrics = title.toUpperCase() + "\n---\n";
var even, verse;
var sayAnimal = function(i) {
even = !even
# A Liquid tag for random number generation
# Usage: {% random min:max %} where min and max are integers and min < max
module Jekyll
class Random < Liquid::Tag
def initialize(tag_name, range, tokens)
super
limits = range.split(":")
@min = limits[0].to_i
@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 / 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 / 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 / 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 / _mixin.scss
Created October 4, 2012 14:20 — forked from electricg/_mixin.scss
My SCSS mixin
@mixin box-sizing ($box) {
-webkit-box-sizing: $box;
-moz-box-sizing: $box;
box-sizing: $box;
}
@mixin border-radius ($val) {
-webkit-border-radius: $val;
-moz-border-radius: $val;
border-radius: $val;
@fcalderan
fcalderan / mq.css
Created October 4, 2012 09:28 — forked from chriscoyier/mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@fcalderan
fcalderan / inline-block-example.html
Created July 21, 2011 10:07
A helper class for an easy and crossbrowser inline-blocks usage (with H5BP).
<ul class="ibw">
<li>inline block</li>
<li>inline block</li>
<li>inline block</li>
</ul>
<section class="ibw">
<article class="ib">...</article>
<aside class="ib">...</aside>
</section>