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 tips.md

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
rbartoli / install-pm2.sh
Last active Sep 28, 2016
PM2 installation steps
View install-pm2.sh
# 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
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 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:

You can’t perform that action at this time.