Skip to content

Instantly share code, notes, and snippets.

@digital-drifter
digital-drifter / example.localhost.conf
Last active October 13, 2018 04:54
Nginx + PHP FPM + Webpack + Laravel
upstream fpm_sock {
server unix:/var/run/php7.2.9-fpm.sock;
}
server {
listen 80;
access_log /var/log/nginx/access.log;
return 301 https://$host$request_uri;
}
@digital-drifter
digital-drifter / gist:148b949b6433cde7aa1f6bbbac74ba1e
Created August 3, 2018 09:31
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~
@digital-drifter
digital-drifter / cors.nginxconf
Created July 30, 2018 18:53 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@digital-drifter
digital-drifter / query.log.php
Created July 29, 2018 17:59
Laravel formatted query logging
Event::listen(QueryExecuted::class, function (QueryExecuted $query) {
// Format binding data for sql insertion
foreach ($query->bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$query->bindings[ $i ] = $binding->format('\'Y-m-d H:i:s\'');
} else {
if (is_string($binding)) {
$query->bindings[ $i ] = "'$binding'";
}
}

Keybase proof

I hereby claim:

  • I am digital-drifter on github.
  • I am digitaldrifter (https://keybase.io/digitaldrifter) on keybase.
  • I have a public key ASD5OJPyI6FBuUMjiq2KfZO5kGiK7Gu3JkiLlCNUTQ-o9wo

To claim this, I am signing this object: