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
View GIT

GIT tips

Fetch a file from another branch to the current one

git checkout branch_name -- filename

Unstage all changes but leave files in the working directory untouched

git reset HEAD

Unstage a file

git reset HEAD

rbartoli /
Last active Sep 28, 2016
PM2 installation steps
# Add safe user
useradd -s /bin/bash -m -d /home/safeuser -c "safe user" safeuser
passwd safeuser
usermod -aG sudo safeuser
# Install PM2
sudo npm install -g pm2
cd project
NODE_ENV=production pm2 start server.js
pm2 startup
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
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 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:

You can’t perform that action at this time.