Skip to content

Instantly share code, notes, and snippets.

View jveldboom's full-sized avatar

John Veldboom jveldboom

View GitHub Profile
@jveldboom
jveldboom / bisac.csv
Created September 12, 2013 18:52
BISAC codes and values
ANT000000 Antiques & Collectibles / General
ANT001000 Antiques & Collectibles / Americana
ANT002000 Antiques & Collectibles / Art
ANT003000 Antiques & Collectibles / Autographs
ANT005000 Antiques & Collectibles / Books
ANT006000 Antiques & Collectibles / Bottles
ANT007000 Antiques & Collectibles / Buttons & Pins
ANT008000 Antiques & Collectibles / Care & Restoration
ANT009000 Antiques & Collectibles / Transportation
ANT010000 Antiques & Collectibles / Clocks & Watches
@jveldboom
jveldboom / php-cli-colors.php
Last active August 24, 2023 15:32
PHP CLI Colors - PHP Class Command Line Colors (bash)
<?php
// from http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
class Colors {
private $foreground_colors = array();
private $background_colors = array();
public function __construct() {
// Set up shell colors
$this->foreground_colors['black'] = '0;30';
$this->foreground_colors['dark_gray'] = '1;30';
<?php
function addOrdinalNumberSuffix($num) {
if (!in_array(($num % 100),array(11,12,13))){
switch ($num % 10) {
// Handle 1st, 2nd, 3rd
case 1: return $num.'st';
case 2: return $num.'nd';
case 3: return $num.'rd';
}
}
@jveldboom
jveldboom / onix_code_list.sql
Created July 26, 2013 13:38
ONIX fields and values SQL
DROP TABLE IF EXISTS `onix_code_list`;
CREATE TABLE `onix_code_list` (
`list_id` int(11) unsigned NOT NULL,
`values` varchar(20) DEFAULT NULL,
`name` varchar(100) DEFAULT '',
`notes` text,
`revision` int(11) unsigned DEFAULT NULL,
KEY `list_id` (`list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@jveldboom
jveldboom / terraform-workspaces-template.tf
Created November 30, 2018 23:52
terraform-workspaces-template
# S3 Bucket
resource "aws_s3_bucket" "deployment" {
bucket = "${local.deployment_bucket}"
}
# Amazon Certificate Manager
resource "aws_acm_certificate" "cert" {
domain_name = "${local.domain}"
validation_method = "DNS"
}
@jveldboom
jveldboom / terraform-workspaces-vars.tf
Last active November 30, 2018 23:46
terraform-workspaces-vars
locals {
deployment_buckets = {
develop = "my-develop-bucket"
staging = "my-staging-bucket"
production = "my-production-bucket"
}
domains = {
develop = "develop.example.com"
@jveldboom
jveldboom / readme.md
Last active March 18, 2018 20:37
Unbuntu 14.04 Vagrant LEMP + Laravel
### Download setup Ubuntu 14.04 box
```
// from local directory
vagrant init chef/ubuntu-14.04
```
### Setup Vagrantfile
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
import boto3
ec2 = boto3.client('ec2');
cloudwatch = boto3.client('cloudwatch');
def lambda_handler(event, context):
count = 0
response = ec2.describe_instances()
for r in response['Reservations']:
count += len(r['Instances'])
class SortMdArray {
public $sort_order = 'asc'; // default
public $sort_key = 'position'; // default
public function sortByKey(&$array) {
usort($array, array(__CLASS__, 'sortByKeyCallback'));
}
function sortByKeyCallback($a, $b) {
if($this->sort_order == 'asc') {
@jveldboom
jveldboom / gist:6481874
Created September 8, 2013 04:37
quick example
<?php
require_once app_path().'/libraries/google-api-php-client/src/Google_Client.php';
require_once app_path().'/libraries/google-api-php-client/src/contrib/Google_AnalyticsService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google Analytics PHP Starter Application");
// Visit https://code.google.com/apis/console?api=analytics to generate your