Skip to content

Instantly share code, notes, and snippets.

View nicdavies's full-sized avatar
🐝

Nic Davies nicdavies

🐝
  • Wales, United Kingdom
View GitHub Profile
@olih
olih / jq-cheetsheet.md
Last active March 12, 2026 17:14
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@skl
skl / Module.php
Created September 16, 2015 16:13
ZF2 ModuleEvent listener that prioritises `ViewJsonStrategy` over `ZfcTwigViewStrategy` in order to properly render a JsonModel.
<?php
namespace Application;
use Zend\ModuleManager\ModuleEvent;
use Zend\ModuleManager\ModuleManager;
/**
* Class Module
* @package Application
@jeremyvaught
jeremyvaught / domain.io.txt
Last active November 8, 2019 11:13
Laravel Forge wildcard domain with ssl
#/etc/nginx/sites-available/domain.io
server {
listen 80;
server_name domain.io *.domain.io;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name .domain.io;
@Ocramius
Ocramius / .gitignore
Last active January 10, 2023 16:34
`Zend\EventManager` examples
vendor
composer.lock
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active February 23, 2026 14:28
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@troy
troy / send_remote_syslog.php
Last active March 30, 2025 16:15
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);