Skip to content

Instantly share code, notes, and snippets.

Jay Elaraj nerdcave

Block or report user

Report or block nerdcave

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
@nerdcave
nerdcave / environment.js
Last active Mar 12, 2020
PurgeCSS config for Rails 5 and Webpacker (along with Tailwind CSS and Vue.js, in this case)
View environment.js
// first run:
// yarn add glob-all purgecss-webpack-plugin --dev
/*
config/webpack/environment.js
PurgeCSS configuration for Rails 5 + Webpacker + Tailwind CSS + Vue.js
Optionally, put this in production.js if you only want this to apply to production.
For example, your app is large and you want to optimize dev compilation speed.
*/
@nerdcave
nerdcave / vue-test-slots.js
Created Mar 1, 2018
"Duplicate presence of slot" warning with trigger 'click' leveled/nested slots and vue-test-utils
View vue-test-slots.js
// Jasmine v2.7
import {mount} from '@vue/test-utils/dist/vue-test-utils';
const Parent = {
name: 'Parent',
template: `
<Child>
<template slot-scope="props">
<slot name="content"></slot>
@nerdcave
nerdcave / js-test-lazy-evaluate.js
Last active Feb 22, 2018
JavaScript testing with lazy loading/evaluation (like Rspec let)
View js-test-lazy-evaluate.js
// Uses Jasmine's `this` feature:
// https://jasmine.github.io/2.9/introduction#section-The_<code>this</code>_keyword
// Example without lazy evaluation:
const sum = (a, b) => a + b;
describe('No lazy eval :(', () => {
let a, b, total;
You can’t perform that action at this time.