Skip to content

Instantly share code, notes, and snippets.

View colinwilson's full-sized avatar
⚗️

Colin Wilson colinwilson

⚗️
View GitHub Profile
@Chrisedmo
Chrisedmo / Craft3ValetDriver.php
Created February 1, 2017 10:29
Craft 3 Composer Install Valet Driver
<?php
class Craft3ValetDriver extends ValetDriver
/* https://github.com/laravel/valet/blob/master/cli/drivers/CraftValetDriver.php */
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
--
-- GEOIP IN POSTGRESQL
--
-- We use two approaches. First using PostgreSQL inet and cidr types and indexing (PostgreSQL 9.4 and later),
-- and then using ip4r (https://github.com/RhodiumToad/ip4r).
-- The performance of ip4r indexes is significantly better than PostgreSQL's own index.
-- An operation that took 42s using ip4r took 47 minutes using PostgreSQL's cidr index.
--
@bobbybouwmann
bobbybouwmann / User.php
Last active May 18, 2024 16:05
Laravel Absolute vs Relative Dates with Carbon
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
@simenbrekken
simenbrekken / schema.js
Created December 21, 2016 14:06
Firebase backed GraphQL schema
import firebase from 'firebase'
import { filter, map } from 'lodash'
import { makeExecutableSchema } from 'graphql-tools'
firebase.initializeApp({
databaseURL: 'https://grafire-b1b6e.firebaseio.com',
})
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() })
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value }))
@maevelander
maevelander / invoicepdf.tpl
Last active December 18, 2021 21:58
Custom Invoice PDF template for WHMCS
<?php
# Logo
$logoFilename = 'placeholder.png';
if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
$logoFilename = 'logo.png';
} elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
$logoFilename = 'logo.jpg';
}
$pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 75);
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@dav3860
dav3860 / zbxjson.py
Last active February 19, 2021 14:19
Zabbix REST/JSON web service check script
For REST/JSON web service that returns :
{
"DatabaseConnections": [
{
"DatabaseName": "database1",
"DatabaseStatus": "Open",
},
{
"DatabaseName": "database2",
"DatabaseStatus": "Open",
@tillkruss
tillkruss / app\Http\Kernel.php
Last active March 9, 2023 14:26
Running Laravel 5 on Heroku behind CloudFlare
<?php
class Kernel extends HttpKernel
{
protected $middleware = [
\App\Http\Middleware\TrustedProxies::class,
];
}
@parmentf
parmentf / GitCommitEmoji.md
Last active May 24, 2024 00:27
Git Commit message Emoji
@jpawlowski
jpawlowski / haproxy.cfg
Last active May 31, 2023 05:41
Geeking out with HAproxy on pfSense: The ultimate port 443 TLS/SSL router | http://loredo.me/post/116633549315/geeking-out-with-haproxy-on-pfsense-the-ultimate
global
maxconn 2000
stats socket /tmp/haproxy.socket level admin
uid 80
gid 80
nbproc 1
chroot /tmp/haproxy_chroot
daemon
tune.ssl.default-dh-param 2048
# Modern browser compatibility only as mentioned here: