Skip to content

Instantly share code, notes, and snippets.

View fgilio's full-sized avatar

Franco Gilio fgilio

View GitHub Profile
@fgilio
fgilio / concurrent-pool.php
Last active February 22, 2022 13:08 — forked from tonysm/concurrent-pool.php
Laravel HTTP client concurrent requests pool
<?php
// 1. Register the routes
Route::get('test/{lorem}', function ($lorem) {
sleep(3);
return response()->json([
'message' => $lorem,
'token' => Str::random(),
]);
@fgilio
fgilio / gitcheats.txt
Created September 26, 2016 15:34 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get most modified files and counts
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g
# Locally checkout all remote branches of a repository
git branch -r | cut -d '/' -f2 | grep -Ev '( |master)' | xargs -Ibranch git checkout -b branch origin/branch
# Open current Git repository URL
@fgilio
fgilio / gist:72a4475f10465a8a0c6b
Created December 12, 2015 23:27 — forked from pudgereyem/gist:c5757e11000cd462b07a
Serve Missing Media from a Production Server via Apache/Nginx
# Serve Missing Media from a Production Server via Apache/Nginx
# When working on the website locally, and you don't want to download (or even have) the images that are used on the live site, a simple redirect solves the problem. You can read a good blog post on this here; <http://rzen.net/serve-missing-media-production-apache-nginx/> by Brian Richards.
###
### For Apache
###
# Attempt to load files from production if they're not in our local version
# If you have development/production setup, it's neat to use .htaccess to redirect all failed requests to the production server (since we wont want to sync all the uploaded media between the two)
<IfModule mod_rewrite.c>
@fgilio
fgilio / api-helper.php
Created October 5, 2015 00:25 — forked from thomasgriffin/api-helper.php
API Helper to be used during API requests. Should be used as a must-use plugin in WordPress.
<?php
/**
* Plugin Name: TGM API Helper
* Plugin URI: https://thomasgriffin.io
* Description: Whitelists the plugins to be loaded during API requests to reduce overhead.
* Author: Thomas Griffin
* Author URI: https://thomasgriffin.io
* Version: 1.0.0
*/
@fgilio
fgilio / logging-helper.php
Last active September 20, 2015 05:54 — forked from jdevalk/logging-helper.php
This little hack enables fatal error logging for your site, without creating an error log that is insanely big.
<?php
/**
* This changes logging to only log fatal errors. This file should go in your mu-plugins directory.
*/
// Set the error logging to only log fatal errors
error_reporting( E_ERROR );
// Optional: change the location of your error log, it might be wise to put it outside your WP content dir.
// If you don't change it, the default place for this log is debug.log in your WP_CONTENT_DIR.
@fgilio
fgilio / csv-to-json.php
Last active August 29, 2015 14:26 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed