Skip to content

Instantly share code, notes, and snippets.


Thiago Vieira Thivieira

View GitHub Profile
JerryBels / anonyClass.php
Last active Jan 25, 2022
Anonymous class generation and usage (from PHP 7)
View anonyClass.php
interface it {
public function tf();
trait t {
public $tv = "tv";
public function tf() {
return "tf";

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
MaikelVeen / next.config.js
Created Jan 9, 2021
Fixing the client bundle build
View next.config.js
module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.node = {
fs: 'empty'
return config
julienbourdeau / webpack.mix.js
Created Apr 20, 2020
Laravel Mix with multiple Tailwind config and PurgeCSS (separate Admin dashboard and Front app)
View webpack.mix.js
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const rootPath = Mix.paths.root.bind(Mix.paths);
const tailwindPlugins = function(configFile, paths) {
const pluginList = [tailwindcss(configFile)];
if (mix.inProduction()) {
RoccoHoward / tailwind-loading-screen.html
Created Aug 2, 2019
TailwindCSS full screen loading page
View tailwind-loading-screen.html
<div id="loading-screen" class="hidden w-full h-full fixed block top-0 left-0 bg-white opacity-75 z-50">
<span class="text-green-500 opacity-75 top-1/2 my-0 mx-auto block relative w-0 h-0">
<i class="fas fa-circle-notch fa-spin fa-5x"></i>
sam-ngu / laravel-mail-components.blade.php
Created May 21, 2019
list of laravel mail markdown components
View laravel-mail-components.blade.php
# Introduction
The body of your message.
@component('mail::button', ['url' => ''])
Button Text
View uploadImageStream.ts
import * as Sentry from "@sentry/node";
import imagemin from "imagemin";
import mozjpeg from "imagemin-mozjpeg";
import sharp from "sharp";
import isJpg from "is-jpg";
import * as aws from "aws-sdk";
import { Upload } from "../../types/graphqlUtils";
import { generateFilename } from "./generateFilename";
export const s3 = new aws.S3({
elijahmanor / index-0-non-debounced.js
Last active May 21, 2021
React Debouncing Events
View index-0-non-debounced.js
import React, { Component } from "react";
import { render } from "react-dom";
import "./index.css";
class Widget extends Component {
state = { text: "" };
handleChange = (e) => {
this.setState({ text: });
render() {
View Visual Studio Code Settings For Laravel
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"editor.fontFamily" : "Fira Code",
"editor.fontLigatures": true,
"emmet.triggerExpansionOnTab": true,
"php.suggest.basic": false,
"editor.autoIndent": true,
"emmet.includeLanguages" : {
gabrielfroes / slugify.js
Last active Jun 20, 2022 — forked from mathewbyrne/slugify.js
Javascript Slugify
View slugify.js
Create SLUG from a string
This function rewrite the string prototype and also
replace latin and other special characters.
Forked by Gabriel Froes -
Original Author: Mathew Byrne -
if (!String.prototype.slugify) {
String.prototype.slugify = function () {