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 / DNS prefetching
Created January 13, 2019 08:37
Common Prefetch Links
<!-- Amazon S3 -->
<link rel="dns-prefetch" href="//s3.amazonaws.com">
<!-- Google CDN -->
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<!-- Microsoft CDN -->
<link rel="dns-prefetch" href="//ajax.microsoft.com">
<link rel="dns-prefetch" href="//ajax.aspnetcdn.com">
@julienbourdeau
julienbourdeau / proxy.md
Last active December 19, 2018 16:09
Algolia PHP client with Proxy

If you're using a proxy, you can either override the HttpClient or use environment variable.

Setting the HttpClient

If you're using the default Guzzle6HttpClient (recommended):

use Algolia\AlgoliaSearch\Algolia;
@julienbourdeau
julienbourdeau / app.yml.md
Created September 16, 2018 18:04
Discourse config for outter Nginx (run other websites next to Discourse)
## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/forum.allraces.org/before/*;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name forum.allraces.org;
    root /home/forge/forum.allraces.org/; # /!\ UPDATE WITH YOUR DOMAIN

Customizing records

All models are converted via the Symfony Serializer component. The bundle also support the popular JMS Serializer bundle.

There are 3 main ways:

  • Use annotations in entity (Not the most powerful but very simple)
  • Write custom normalize method in entity
  • Write custom EntityNormalizer class
@julienbourdeau
julienbourdeau / UserAgent.md
Last active July 18, 2018 23:49
Algolia UserAgents

Algolia UserAgent

The User-Agent should be a semi-colon separated list, where the version is in parenthesis.

For simplicity, the User-Agent should:

  1. start with the API Client version,
  2. followed by language/plateform version,
  3. then every integration can add whatever they want
@julienbourdeau
julienbourdeau / install.bash
Created May 21, 2018 11:20 — forked from val-bubbleflat/install.bash
Install V8Js on Laravel Forge
sudo add-apt-repository ppa:pinepain/libv8-5.2
sudo apt-get update
sudo apt-get install libv8-5.2
sudo pecl install v8js
sudo su
echo "extension=v8js.so" >> /etc/php/7.1/fpm/php.ini
echo "extension=v8js.so" >> /etc/php/7.1/cli/php.ini
exit
sudo service nginx restart && sudo service php7.1-fpm restart

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
@julienbourdeau
julienbourdeau / data.json
Created April 16, 2018 10:15
App data set for Algolia
[
{
"category": "Books",
"name": "iBooks",
"image_ok": false,
"image": "http://is1.mzstatic.com/image/thumb/Purple62/v4/d3/84/38/d38438a5-6cb4-bad5-72c1-64da79f2c200/source/175x175bb.jpg",
"rank": 1,
"link": "http://itunes.apple.com/us/app/ibooks/id364709193?mt=8",
"image_updated": true
},
@julienbourdeau
julienbourdeau / Post.php
Last active June 28, 2023 23:33
Symfony Post entity for Algolia's documentation
<?php
/*
* This file is part of the Symfony/demo project
* https://github.com/symfony/demo
*
*/
namespace App\Entity;