Skip to content

Instantly share code, notes, and snippets.

# 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 / 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
@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 / SASS aspect ratio.css
Last active August 29, 2015 14:23
Generated by SassMeister.com.
section {
width: 35%;
}
section div {
/* Aspect ratio: 16:9 */
height: 0;
width: 100%;
position: relative;
padding-bottom: 56.25%;
}
@fcalderan
fcalderan / SassMeister-input-HTML.html
Last active August 29, 2015 14:24
Generated by SassMeister.com.
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
@fcalderan
fcalderan / JamiroquaiVideos
Created December 10, 2010 11:22
Typical Jamiroquai video explained by a context-free grammar
# Description:
# Typical Jamiroquai video explained by a context-free grammar (just for fun)
JV ::= <epsilon> | <Someone> <Does> <Something> in a <Place> | <Exceptions> ;
Someone ::= He | the invisible man ;
SomeoneElse ::= Him | another invisible man ;
Does ::= (runs away with | follows | drives) a ;
Something ::= (porsche | ferrari | moto | helicopter) followed by <SomeoneElse> <Consequence> ;
Consequence ::= wasting fuel | polluting environment | making roads insecure ;
Place ::= dull desertic land | desert | bright floor;
@fcalderan
fcalderan / deferred-img.js
Created May 6, 2011 09:25
Image loader / preloader achieved by deferred objects in jQuery 1.6
/**
* For a current project I need to wait to execute a code until some images have been loaded.
* Beside, I also need to execute a callback (in my specific code I want to show the image
* with a fade-in effect) every time a single image has been loaded.
*
* So basically I used two deferred objects: the nested one which is resolved for a single
* image successfull load event (or when image has been discarded) and the outside one,
* which is resolved when all deferred objects on single images have been resolved or rejected.
*
* This snippet also takes care all frequent issues when trying to load an image (excessive
@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>
@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 / _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;