Skip to content

Instantly share code, notes, and snippets.

View ajtrichards's full-sized avatar
🏠
Working from home

Alex Richards ajtrichards

🏠
Working from home
  • South Wales
View GitHub Profile
@ajtrichards
ajtrichards / clean-deleted-branches.sh
Created December 25, 2017 19:24
A command to delete merged branches in GIT
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
daemon off;
pid /tmp/nginx.pid;
error_log /dev/stderr info;
worker_processes auto;
events {
worker_connections 1024;
}
http {
@ajtrichards
ajtrichards / lumen-query-log.php
Last active July 7, 2022 23:50
Laravel Lumen - Display Query Log
/**
* You must enable to Query Log when using Lumen.
*/
DB::connection()->enableQueryLog();
$queries = DB::getQueryLog();
$last_query = end($queries);
@ajtrichards
ajtrichards / sql-date-query.sql
Created April 7, 2015 08:44
Unix Date SQL query
SELECT * FROM tablename WHERE date <= UNIX_TIMESTAMP(STR_TO_DATE('Apr 07 2015 09:00AM', '%M %e %Y %h:%i%p'))
@ajtrichards
ajtrichards / color-bash.sh
Created September 13, 2013 13:26
Get some color in your shell!
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
function red() {
echo -e "$RED$*$NORMAL"
}
function green() {
@ajtrichards
ajtrichards / client.html
Created April 30, 2013 09:37
Faye PUB/SUB server
<script type="text/javascript" src="http://localhost:8000/faye/client.js"></script>
<script type="text/javascript">
/*
** Script to handle notifications
*/
var client = new Faye.Client('http://localhost:8000/faye',{
timeout: 120
});