Skip to content

Instantly share code, notes, and snippets.

Federico Brigante fregante

Block or report user

Report or block fregante

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 index.js
Promise.reject(1).catch(err => {
if (err instanceof Error) {
throw err; // Exception
// Rejection


Personal launcher to start working in whatever directory you're into. Customize it as needed

$ work
# tries launching
# tries launching Sublime Text
# tries launching the build tool (npm run watch, gulp, grump in this order)
fregante / bookmarklet.js
Last active Jun 7, 2016
Play videos inline on the iPhone (bookmarklet)
View bookmarklet.js
// to be flattened with
var s = document.createElement('script');
s.onload = function () {
[]'video'), makeVideoPlayableInline);
fregante / show-reddit-posts.js
Last active Feb 25, 2016
Bookmarklet: show current url posted on Reddit
View show-reddit-posts.js
// Create bookmarklet with:
var getPermalink = post => '';
var getPermalinks = r =>;
var buildLink = url => {
var a = document.createElement('a');
a.href = url;
a.textContent = url.match(/\/r\/[^/]+/) && url.match(/\/r\/[^/]+/)[0] || url; = 'block';
return a;
fregante / header.js
Last active May 21, 2016 — forked from dominikwilkowski/
Doc strange outline love (jQuery-free)
View header.js
//detecting tab key press
document.body.addEventListener('keydown', function detector (e) {
var keyCode = e.keyCode || e.which;
if(keyCode == 9) {
console.log( 'Tab detected' );
document.documentElement.className += ' is-keyboarduser';
document.body.removeEventListener('keydown', detector);
fregante /
Last active Dec 26, 2016
If you preventDefault on clicks, wrap the handler with this
fregante /
Created Jun 30, 2015
Use git get and put instead of git pull and push

As explained on Don't Be Scared of git rebase, git fetch+rebase is a better alternative to git pull; unfortunately it's not as concise.

git get

From now on, use git get instead of git pull, a custom command that does this:

# get data from remote
git fetch origin
# rebase the remote branch with the same name as local
You can’t perform that action at this time.