Skip to content

Instantly share code, notes, and snippets.

Andrew Del Prete andrewdelprete

Block or report user

Report or block andrewdelprete

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
@andrewdelprete
andrewdelprete / Counter.spec.js
Last active Jul 15, 2018
Integration test a Vue component with vue-testing-library
View Counter.spec.js
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 Feb 28, 2018
Zero config Apollo + GraphQL with apollo-boost
View index.js
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 Dec 9, 2019
Webpack: Tailwind CSS + PurgeCSS Example
View webpack.config.js
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 Nov 25, 2019
Laravel Mix: Tailwind CSS + PurgeCSS Example
View webpack.mix.js
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
*/
View gist:d55233501e1729694ca739393672ac58
"workbench.colorCustomizations": {
"statusBar.foreground": "#eeffff",
"statusBar.background": "#8252be",
"titleBar.activeForeground": "#eeefff",
"titleBar.activeBackground": "#282b3c"
},
View .vimrc
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'
View AssetUrls.js
// 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 Sep 13, 2016
NeckbeardJS - Pass an Object
View neckbeard-style-object.js
// 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": {
View gist:f431c04b2481df7fc1caf59521c7bba5
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 Feb 28, 2016
Callback > Promises > Async / Await
View async.js
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' })
}
You can’t perform that action at this time.