Skip to content

Instantly share code, notes, and snippets.

View julienbourdeau's full-sized avatar
🌎
San Franscico until Friday 28th

Julien Bourdeau julienbourdeau

🌎
San Franscico until Friday 28th
View GitHub Profile
@julienbourdeau
julienbourdeau / .php_cs
Last active November 8, 2020 19:14
Minimalist PHP CS Fixer config for Laravel
<?php
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__.'/app',
__DIR__.'/tests',
])
;
$rulesToDisable = [
@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')({
Bundler could not find compatible versions for gem "actionmailer":
In Gemfile:
devise_invitable was resolved to 2.0.1, which depends on
actionmailer (>= 5.0)
rails (= 5.0.7.2) was resolved to 5.0.7.2, which depends on
actionmailer (= 5.0.7.2)
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:

Using sprockets 2.12.5

sprockets-rails 2.3.3

$ ab -c 1 -n 100 http://localhost:3000/posts/1
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done
@julienbourdeau
julienbourdeau / algolia.test.conf
Last active July 5, 2019 21:46
Nginx config for Rails app (used with Laravel Valet)
# /usr/local/etc/nginx/servers/algolia.test
upstream myapp {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
@julienbourdeau
julienbourdeau / contact.rb
Created March 19, 2019 16:52
Rails Algolia: Create subindex but without main index.
class Contact < ApplicationRecord
include AlgoliaSearch
algoliasearch per_environment: true, if: :turn_off_main_index do
add_index "CONTACT_subset", if: :subset? do
attributes :name, :email, :company, :state
searchableAttributes ['name', 'company', 'unordered(email)']
@julienbourdeau
julienbourdeau / dedup.sql
Created March 2, 2019 20:57
Delete duplicate entries from db with single SQL query
-- example from www.lasceneparisienne.com DB
DELETE n1 FROM calendar_events n1,
calendar_events n2
WHERE n1.id < n2.id
AND n1.id_facebook = n2.id_facebook
AND n1.calendar_id = 2;
@julienbourdeau
julienbourdeau / HtmlSplitter.php
Last active January 25, 2019 09:29
Algolia record split - HtmlSplitter
<?php
declare(strict_types=1);
/**
* This file is part of Scout Extended.
*
* (c) Algolia Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE