Skip to content

Instantly share code, notes, and snippets.

View 1stevengrant's full-sized avatar
🏠
Working from home

Steven Grant 1stevengrant

🏠
Working from home
View GitHub Profile
@josecanhelp
josecanhelp / meilisearch-forge.md
Last active March 21, 2024 14:39
Install MeiliSearch on Forge servers

Although MeiliSearch offers steps to install via apt, there are some dependency libraries that are not installable on the server architecture we have availble on our Tighten Forge servers. However, the servers can run the program just fine with the binary. Here are the steps I took to make it work.

Download the stable release

curl -L https://install.meilisearch.com | sh

Change the ownership and modify permissions

chmod 755 meilisearch chown root:root meilisearch

Move the binary to a system-wide available path

@sudkumar
sudkumar / channels.tsx
Last active April 12, 2024 07:50
Web-Sockets in ReactJS with PusherJs and Laravel Echo with public and private channels
import React, { useEffect, useState, useMemo } from "react"
import Echo from "laravel-echo"
import Pusher from "pusher-js"
/**
* Pusher configuration
*/
const pusherConfig = {
key: '<your_pusher_key_here>',
cluster: '<pusher_cluster>',
@julienbourdeau
julienbourdeau / webpack.mix.js
Created April 20, 2020 06:43
Laravel Mix with multiple Tailwind config and PurgeCSS (separate Admin dashboard and Front app)
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()) {
pluginList.push(require('@fullhuman/postcss-purgecss')({
@djoudi
djoudi / Kernel.php
Created March 22, 2020 07:56 — forked from ciamarro/Kernel.php
Maintain localization / locale when using Laravel Livewire
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
//----
@reinink
reinink / DateInput.vue
Created August 27, 2019 11:51
Pikaday Vue Component
<template>
<div>
<label v-if="label" class="form-label" :for="`date-input-${_uid}`">{{ label }}:</label>
<input v-bind="$attrs" class="form-input" :id="`date-input-${_uid}`" :class="{ error: error }" type="text" ref="input" :value="value" @change="change" @keyup="change">
<div v-if="error" class="form-error">{{ error }}</div>
</div>
</template>
<script>
import pikaday from 'pikaday'
@piotrpog
piotrpog / yt_address.twig
Last active July 6, 2021 10:35
Twig macro turning youtube video URL into responsive and lazy-loaded player. More info: http://craftsnippets.com/articles/responsive-and-lazy-loaded-youtube-videos-with-craft-cms
{# v2 #}
{%- macro ytAddress(url, lazy = true) -%}
{% if url is not empty %}
{% set id = url|split('v=')|last %}
{% set id = id|split('&')|first %}
{% set id = id|split('/')|last %}
<div class="youtube-player">
<figure style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 0px;">
<iframe src="https://www.youtube.com/embed/{{id}}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"{{ lazy ? ' loading="lazy"'}}></iframe>
@EmadAdly
EmadAdly / Add-ESLint-to-Laravel-Mix.md
Last active January 20, 2024 16:55
Adding eslint to your Laravel application

1. Add eslint and eslint-loader and eslint-plugin-vue to your projects package.json file

npm i eslint eslint-loader eslint-plugin-vue --save-dev

2. Create a base configuration by --init

@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@reinink
reinink / webpack.mix.js
Created November 20, 2017 13:19
Using Purgecss with Tailwind and Laravel Mix
let cssImport = require('postcss-import')
let cssNext = require('postcss-cssnext')
let glob = require('glob-all')
let mix = require('laravel-mix')
let purgeCss = require('purgecss-webpack-plugin')
let tailwind = require('tailwindcss')
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css/app.css', [
cssImport(),
.form-label {
@apply .mb-2 .block .text-sm .text-dark;
}
.form-input,
.form-textarea,
.form-select {
@apply .p-2 .leading-normal .block .w-full .border .text-dark .bg-light .text-sm .font-sans .rounded .text-left .appearance-none;
&:focus {