Skip to content

Instantly share code, notes, and snippets.

View ramonvictor's full-sized avatar

Ramon Bezerra ramonvictor

View GitHub Profile
const crashReporter = store => next => action => {
try {
return next(action)
} catch (err) {
console.error('Caught an exception!', err)
// capture error somehow here: action, store.getState()
throw err;
}
}
@paulirish
paulirish / what-forces-layout.md
Last active May 21, 2024 09:11
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ricardobeat
ricardobeat / git-open
Created September 29, 2014 12:05
git-open - open all modified files
#!/bin/bash
#
# Open all changed files in Sublime Text
#
# Install:
# save this file to /usr/local/bin/git-open
# chmod +x /usr/local/bin/git-open
#
# It will now be available as 'git open'
#
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@samuelhorn
samuelhorn / gulpfile.js
Last active December 9, 2022 09:38
My gulpfile for new projects
/*******************************************************************************
1. DEPENDENCIES
*******************************************************************************/
var gulp = require('gulp'); // gulp core
sass = require('gulp-sass'), // sass compiler
uglify = require('gulp-uglify'), // uglifies the js
jshint = require('gulp-jshint'), // check if js is ok
rename = require("gulp-rename"); // rename files
concat = require('gulp-concat'), // concatinate js
@houoop
houoop / get-tomorrow-date.js
Created April 28, 2013 03:44
js get tomorrow date
new Date(new Date().getTime() + 24 * 60 * 60 * 1000)
@bennadel
bennadel / index.htm
Created September 12, 2012 13:17
Mapping AngularJS Routes Onto URL Parameters And Client-Side Events
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>AngularJS Routing</title>
<style type="text/css">
a {
@avar
avar / 30-income-calculon.pl
Last active February 12, 2024 18:34
Calculate your income in The Netherlands with and without a 30% ruling.
# To check if this is up-to-date with the tax rates go to
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything
# newer there.
#
# I make no guarantees that any of this is correct. I calculated this
# at the time and have been updating it when new tax rates come along
# because people keep finding this useful.
#
# There's also an interactive JS version of this created by
# @stevermeister at