Skip to content

Instantly share code, notes, and snippets.

View andrewdelprete's full-sized avatar
💭
I may be slow to respond.

Andrew Del Prete andrewdelprete

💭
I may be slow to respond.
View GitHub Profile
@andrewdelprete
andrewdelprete / Counter.spec.js
Last active July 15, 2018 20:45
Integration test a Vue component with vue-testing-library
import { render, Simulate } from "vue-testing-library";
import Counter from "@/components/Counter.vue";
describe("Counter.vue", () => {
it("increments by 1 on click", () => {
const { getByTestId, getByText } = render(Counter);
Simulate.click(getByText("Increments"));
expect(getByTestId("count").textContent).toBe("1");
});
@andrewdelprete
andrewdelprete / index.js
Created February 28, 2018 23:33
Zero config Apollo + GraphQL with apollo-boost
import React from "react";
import { render } from "react-dom";
import ApolloClient from "apollo-boost";
import { ApolloProvider } from "react-apollo";
import IpCountryFinder from "./containers/IpCountryFinder";
const client = new ApolloClient({
uri: "https://api.graphloc.com/graphql",
clientState: {
defaults: {
@andrewdelprete
andrewdelprete / webpack.config.js
Last active April 12, 2023 01:55
Webpack: Tailwind CSS + PurgeCSS Example
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require("path");
const glob = require("glob-all");
const PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@andrewdelprete
andrewdelprete / webpack.mix.js
Last active July 17, 2020 09:26
Laravel Mix: Tailwind CSS + PurgeCSS Example
let mix = require("laravel-mix");
let tailwindcss = require("tailwindcss");
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
"workbench.colorCustomizations": {
"statusBar.foreground": "#eeffff",
"statusBar.background": "#8252be",
"titleBar.activeForeground": "#eeefff",
"titleBar.activeBackground": "#282b3c"
},
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
// app/Http/Middleware/AssetUrls.js
// Middleware to load mix-manifest.json
// file Laravel Mix generates
class AssetUrls {
* handle (request, response, next) {
const View = use('View')
View.global('assetUrls', function () {
return require('../../../public/mix-manifest.json')
@andrewdelprete
andrewdelprete / neckbeard-style-object.js
Last active September 13, 2016 03:50
NeckbeardJS - Pass an Object
// https://www.neckbeardjs.com/usage
import Neckbeard from 'neckbeard';
const nb = Neckbeard.create();
// Pass your own custom styles object to be injected
// into the DOM dynamically using Aphrodite.
// You can use Neckbeard styles to compose!
const styles = {
"text": {
Error: /Users/andrewdelprete/Work/Code Testing/my-app/node_modules/react-scripts/config/eslint.js: Configuration for rule "array-callback-return" is invalid: Value "warn" is the wrong type.
Referenced from: /Users/andrewdelprete/Work/Code Testing/my-app/package.json
Error: /Users/andrewdelprete/Work/Code Testing/my-app/node_modules/react-scripts/config/eslint.js:
Configuration for rule "array-callback-return" is invalid:
Value "warn" is the wrong type.
@andrewdelprete
andrewdelprete / async.js
Created February 28, 2016 03:29
Callback > Promises > Async / Await
import axios from 'axios' // for promise examples
import request from 'request' // for callback example
/**
* Services
*/
const service = {
getPeople: () => axios({ url: 'http://localhost:3000/people' }),
getPlaces: () => axios({ url: 'http://localhost:3000/places' })
}