Skip to content

Instantly share code, notes, and snippets.

View beporter's full-sized avatar

Brian Porter beporter

View GitHub Profile
@beporter
beporter / belongstomany-patch.sh
Created November 2, 2015 15:57
A quick diff and script to resolve cakephp/cakephp#7626 until that PR can be merged. Save these files in your project root dir, make the .sh executable, and run it. Assumes CakePHP v3.1.3 is in use.
#!/usr/bin/env bash
#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Apply the belongstomany.patch file to your cakephp source in vendor/
@beporter
beporter / thumbs.php
Last active April 19, 2022 09:23
A quick PHP script to generate a folder of thumbnails from a source folder of JPG image files. PHP must be able to write files to the local directory.
<?php
// Make sure we see processing errors during development/testing.
error_reporting(E_ALL);
ini_set('display_errors', true);
// Set up operating parameters.
$filePattern = 'gallery/*.[jJ][pP][gG]';
$thumbPattern = 'thumbs/%s';
$targetWidth = 200;
@beporter
beporter / composer
Last active September 11, 2015 18:55
A wrapper script for composer that recognizes a COMPOSER_NODEV environment variable. See: https://github.com/composer/composer/issues/4408
#!/usr/bin/env bash
# [email protected]
#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Wrapper around composer to make it "aware" of a custom
@beporter
beporter / weekbyweek.php
Created September 2, 2015 23:10
A quick command line PHP script to scrape "week by week" pregnancy updates from thebump.com's API into local .html files.
<?php
/**
* A command line script to grab the "week-by-week" updates from
* TheBump.com's API and save them to local .html files.
*
* Tries to be respectful and cache all results to avoid unecessary HTTP
* calls. Uses the API key that thebump.com's own website uses. No malice
* is intended by this.
*
* Usage:
@beporter
beporter / sfcvs2git.sh
Last active August 29, 2015 14:27
A script to automate converting a SourceForge.net CVS repo into a git repo.
#!/usr/bin/env bash
#
#---------------------------------------------------------------------
usage ()
{
cat <<EOT
${0##*/}
Wraps up the commands required to dump a SourceForge CVS repo
@beporter
beporter / git-find-repos
Created August 10, 2015 22:04
Find all git repos (folders containing a `.git/` subdirectory) in the provided path (defaults to current directory.)
#!/usr/bin/env bash
#
# Find and list all git repos (folders containing .git/ directories)
# in the provided path (defaults to current dir.)
#
# Designed to run on a Mac, so make sure you have GNU `findutils`
# and the `terminal-notifier` gem installed.
#
# [email protected]
# v1.0 2015-08-10
@beporter
beporter / git-deploy
Last active June 9, 2016 18:02
A git add-on script that automates fast-forwarding branches to each other, pushing to the default remote (origin) and triggering pre/post scripts. Read `usage()` for details.
#!/usr/bin/env bash
#
# https://gist.github.com/beporter/8074237fa5a71f77dc5c
# [email protected]
# 2015-09-14
#---------------------------------------------------------------------
usage ()
{
@beporter
beporter / composer-create-project-test.sh
Last active January 9, 2020 20:28
Make the process of testing a `composer create-project` command easier by operating against your local working copy.
#!/usr/bin/env bash
# Allows you to test the create-project process using your local
# checked-out copy of the skeleton as the source. You MUST commit the
# changes you want to test to a git branch! You MUST name that branch
# as the first argument and the destination path to set up the fresh
# copy into as the second.
#
# Usage:
# - Place this script in your package's root directory and make it executable.
# - Set the PACKAGE_NAME variable below to match your composer.json's `name`.
@beporter
beporter / keybase.md
Created November 5, 2014 21:32
Proving GitHub identity for Keybase.

Keybase proof

I hereby claim:

  • I am beporter on github.
  • I am beporter (https://keybase.io/beporter) on keybase.
  • I have a public key whose fingerprint is A6BB 0797 14AB 98D6 302E 340F CFDE 3154 EF8B 48D3

To claim this, I am signing this object:

@beporter
beporter / nostalgia.c
Created October 29, 2014 13:35
Decided to see if I could still write C from memory.
// Compile: `gcc -Wall -o hello nostalgia.c`
// Run: `./hello`
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char** argv) {
printf("Hello world.\n");
return(0);
}