Skip to content

Instantly share code, notes, and snippets.

Riccardo Bartoli rbartoli

Block or report user

Report or block rbartoli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rbartoli /
Created Apr 2, 2016 — forked from zenorocha/
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description


TODO: Describe the installation process


rbartoli / simple-react-playground.html
Created Mar 28, 2016 — forked from voronianski/simple-react-playground.html
Quick React prototyping in browser on the fly with ES2015. Use this as boilerplate for your playground and upload html file on some server. Created as a solution for this challenge - with the help of…
View simple-react-playground.html
<!doctype html>
<meta charset="utf-8">
<title>React Quick Prototyping</title>
<div id="root"></div>
<script src=""></script>
View simple-cache.js
// Create an instance of our cache and set some keys. Notice that the [new] operator
// is optional since the SimpleCache (and revealing module pattern) doesn't use
// prototypical inheritance. And, we can use method-chaining to set the cache keys.
var cache = SimpleCache()
.set( "foo", "Bar" )
.set( "hello", "world" )
.set( "beep", "boop" )
console.log( cache.has( "beep" ) );
View template.spec.js
describe( 'Top level suite', function() {
describe( 'Second level test suite', function() {
before( function() {
// executes once, before all tests
} );
beforeEach( function() {
// executes before each test of the suite
View js: mustard cutting
if('querySelector' in document && 'localStorage' in window && 'addEventListener' in window) {
// bootstrap the javascript application
rbartoli /
Created Mar 29, 2015
Linux: create swap file
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap defaults 0 0" > /etc/fstab
View .gitconfig
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 50 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# Commit all changes
cm = !git add -A && git commit -m
# Switch to a branch, creating it if necessary

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

rbartoli / js: event delegation
Last active Aug 29, 2015
Vanilla JS event delegation
View js: event delegation
document.getElementById( 'menu' ).addEventListener( 'click', function( event ) {
if( && === 'LI' ) {
// Event triggered
rbartoli /
Last active Aug 29, 2015
Example bash script provisioner for Ubuntu 14.04.1 (x64)
sudo locale-gen en_GB.UTF-8
sudo addgroup vagrant www-data
# Set timezone (UTC)
echo "Etc/UTC" | sudo tee /etc/timezone && sudo dpkg-reconfigure --frontend noninteractive tzdata
# Update system
sudo apt-get update
sudo apt-get -y dist-upgrade
You can’t perform that action at this time.