Skip to content

Instantly share code, notes, and snippets.

View craigrodway's full-sized avatar

Craig A Rodway craigrodway

View GitHub Profile
@tuupola
tuupola / MonologSQLLogger.php
Last active June 12, 2017 04:33
Monolog logging with Spot2 and Slim
<?php
/* This is old, use https://github.com/tuupola/dbal-psr3-logger instead. */
namespace Doctrine\DBAL\Logging;
class MonologSQLLogger implements SQLLogger {
public $logger;
public $sql = "";
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@jeremeamia
jeremeamia / aws-csv-streamwrapper.php
Created June 6, 2014 18:23
Shows how to read a CSV stored in S3 using the AWS SDK for PHP's S3 Stream Wrapper.
<?php
require __DIR__ . '/vendor/autoload.php';
$s3 = Aws\S3\S3Client::factory($config);
$s3->registerStreamWrapper();
$url = 's3://{$bucket}/{$key}';
// Read CSV with fopen
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active May 23, 2022 12:28
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@Da-Fecto
Da-Fecto / FieldtypeFolder.module
Last active January 1, 2016 09:49
ProcessWire files in folder Fieldtype & Inputfield.
<?php
/**
* ProcessWire files in folder Fieldtype
*
* ©2013 Martijn Geerts
*
* ProcessWire 2.x
* Copyright (C) 2010 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
@yckart
yckart / Log.module
Last active January 31, 2016 06:38
Log.module - A lightweight logging wrapper around ProcessWire's session message/error
<?php
class Log extends WireData implements Module {
/**
* getModuleInfo is a module required by all modules to tell ProcessWire about them
*
* @return array
@djekl
djekl / .gitignore
Created July 12, 2013 10:03
Default .gitignore used to start projects
########################################
### SOME SENSIBLE DEFAULTS BELOW ###
# https://github.com/github/gitignore #
########################################
@somatonic
somatonic / ImageCreateThumbs.module
Last active January 31, 2017 13:08
create thumbs when uploading image
<?php
class ImageCreateThumbs extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'ImageCreateThumbs',
'version' => 100,
'summary' => '',
@somatonic
somatonic / RandomImages.module
Last active December 17, 2015 06:49
get random images across pages optimized
<?php
/**
* Example use:
*
* $helper = $modules->get("RandomImages");
* $image = $helper->getRandomImages(1,"images");
* echo "<img src='{$image->size(150,0)->url}'>";
*/