Skip to content

Instantly share code, notes, and snippets.

View gugiserman's full-sized avatar
:shipit:

Gustavo Giserman gugiserman

:shipit:
View GitHub Profile
@gugiserman
gugiserman / bypass-recharts-responsive-container-tests-error.js
Last active August 9, 2020 23:32
Bypass recharts ResponsiveContainer width and height warnings in jest
// jest.setup.js
const MockResponsiveContainer = props => <div {...props} />
jest.mock('recharts', () => ({
...jest.requireActual('recharts'),
ResponsiveContainer: MockResponsiveContainer,
}))
@gugiserman
gugiserman / react-ignore-unsafe-warn.js
Last active August 9, 2020 23:32
Ignore React componentWillReceiveProps has been renamed warn in tests
// jest.setup.js
const consoleWarn = console.warn
delete console.warn
console.warn = (...args) => {
const message = args[0]
if (message.indexOf('componentWillReceiveProps has been renamed') !== -1) {
return false
function vtexIOSourceMapURLPlugin(options) {}
vtexIOSourceMapURLPlugin.prototype.apply = function(compiler) {
compiler.plugin('emit', function(compilation, callback) {
compilation.chunks.forEach(function(chunk) {
chunk.files.forEach(function(filename) {
var chunkFileValue = compilation.assets[filename] && compilation.assets[filename]._value;
if (!chunkFileValue) return;
compilation.assets[filename]._value = chunkFileValue.replace(
@gugiserman
gugiserman / preprocessor_fun.h
Last active August 29, 2015 14:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@gugiserman
gugiserman / coffee-mode-this.el
Created August 5, 2015 15:53
Highlights "@" with different color in coffee-mode
(defface my/coffee-at-mark
'((t (:foreground "green")))
"my at mark")
(font-lock-add-keywords
'coffee-mode
'(("\\(@\\)\\([_[:word:]]+\\|\\<this\\)\\>"
(1 'my/coffee-at-mark)
(2 font-lock-variable-name-face))))
@gugiserman
gugiserman / partition-filter.coffee
Last active August 29, 2015 14:03
Partition of array in rows of given columns (AngularJS Filter)
.filter 'partition', ($cacheFactory) ->
cache = $cacheFactory 'partition'
(list, colLimit) ->
return if !list or list.length < 1
# PARTITION OF ORIGINAL ARRAY
groups = []
index = 0
for i in [0..Math.ceil(list.length / colLimit) - 1]
groups.push list[index..index + (colLimit - 1)]