Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jaywilliams's full-sized avatar
🌱
Waiting for Spring to begin...

Jay Williams jaywilliams

🌱
Waiting for Spring to begin...
View GitHub Profile
@jaywilliams
jaywilliams / array_to_object.php
Created December 16, 2009 04:57
Convert a multi-dimensional array into a stdClass object. Pass by reference.
<?php
/**
* Convert a multi-dimensional array into a stdClass object.
*
* Example:
* $values = array('hello'=>'world');
*
* // Convert the array to an object
* array_to_object($values);
*

See Also: https://wiki.archlinux.org/index.php/Xorg#Setting_DPI_manually

Setting DPI manually Note: While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.

# The bang exclamation is used for comments in the Xresources file
nano $HOME/.Xresources
------------------------------------------------

!Xft.dpi: 96

@jaywilliams
jaywilliams / searchd
Last active January 9, 2019 17:00
A working OpenBSD Sphinx Search rc.d init script
#!/bin/ksh
#
# searchd - Sphinxsearch network daemon
#
# Use --nodetach flag in combination with rc_bg to workaround searchd not
# listening on specified network ports
daemon="/usr/local/bin/searchd"
daemon_flags="--nodetach"
# daemon_user="www"
@jaywilliams
jaywilliams / sub_category_products.xml
Created December 19, 2013 19:27
A vQmod for OpenCart 1.5.6 to display products in sub-categories.
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id>Display products in sub-categories while browsing a parent category</id>
<version>1.0.0</version>
<vqmver>2.4.0</vqmver>
<author>Jay Williams - jay@myd3.com</author>
<file name="catalog/controller/product/category.php">
<operation>
<search position="after"><![CDATA['filter_category_id' => $category_id,]]></search>
<add><![CDATA[ 'filter_sub_category' => true,]]></add>
@jaywilliams
jaywilliams / Twilight Terminal Theme.mdown
Created August 1, 2012 16:41
Twilight Theme Terminal Colors

Twilight Theme Terminal Colors

Based on the timeless TextMate theme.

Basic Colors

Foreground:     #FEFFD3

Background: #141414

@jaywilliams
jaywilliams / deploy.rb
Last active July 11, 2022 00:32 — forked from el-rotny/deploy.rb
set :repo_url, 'git@github.com:Design-Collective/some-repo.git'
set :application, 'the-app-name.com'
set :theme_name, 'sage'
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
# Hardcodes branch to always be master
# This could be overridden in a stage config file
@jaywilliams
jaywilliams / convert_ascii.php
Created May 28, 2009 19:25
This simple function will remove any non-ASCII character. Feel free to fork and extend!
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517
@jaywilliams
jaywilliams / convert.php
Last active April 13, 2023 04:23
# Convert a QuickBooks QBXML Report to HTML/CSV File # I created this little script to help me read through the raw XML responses from QuickBooks. I originally built it to export to a CSV file, but found that a simple HTML table was better suited for my usage. However, I've included the CSV code below for anyone who may need that functionality. …
<?php
/**
* Convert a QuickBooks QBXML Report to HTML/CSV File
*
* I created this little script to help me read through the raw XML responses
* from QuickBooks. I originally built it to export to a CSV file, but found
* that a simple HTML table was better suited for my usage. However, I've
* included the CSV code below for anyone who may need that functionality.
*
@jaywilliams
jaywilliams / gist:979039
Last active May 18, 2023 16:13
Installing PHP 7.4.33 as CGI on *new* Pair Networks architecture
# Installing PHP 7.4.33 as CGI/FastCGI on a Pair Networks VPS
# By Jay Williams <http://myd3.com/>
# Based off of the Pair Users wiki page "Installing PHP5 as cgi" <http://www.pairusers.com/?How%20to%20install%20PHP5>
# Note: Replace "USERNAME" with your actual server username
# Make src directory in home
mkdir ~/src
# Download, configure, and compile OpenSSL
@jaywilliams
jaywilliams / dumprequest.php
Last active November 8, 2023 12:28 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/jaywilliams/bee2512f0f12d6791315d6939119e135
// Forked: https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
// Usage: php -S localhost:8080 dumprequest.php
// Path to store all incoming requests
define('LOG_OUTPUT', __DIR__ . '/requests.log');
$data = sprintf(
"[%s]\n%s %s %s\n\nHTTP HEADERS:\n",