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
rbartoli / README.md
Created Apr 2, 2016 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet
View README.md

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

@rbartoli
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 - http://blog.vjeux.com/2015/javascript/challenge-best-javascript-setup-for-quick-prototyping.html with the help of https://github.com/voronianski/babel-transform-in-…
View simple-react-playground.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>React Quick Prototyping</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.min.js"></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
rbartoli / create-swap.sh
Created Mar 29, 2015
Linux: create swap file
View create-swap.sh
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
[alias]
# 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
View GIF-Screencast-OSX.md

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

Instructions

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

@rbartoli
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( event.target && event.target.nodeName === 'LI' ) {
// Event triggered
}
});
@rbartoli
rbartoli / vagrant-bootstrap.sh
Last active Aug 29, 2015
Example bash script provisioner for Ubuntu 14.04.1 (x64)
View vagrant-bootstrap.sh
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.