Skip to content

Instantly share code, notes, and snippets.

View grafikchaos's full-sized avatar

Josh J. grafikchaos

View GitHub Profile
@grafikchaos
grafikchaos / 01-README.md
Created October 26, 2016 20:52 — forked from petemcw/01-README.md
Mac OS X LEMP Configuration

Mac OS X LEMP Configuration

This Gist is a collection of configuration files that can be used to easily setup a Homebrew-based LEMP stack on Mac OS X.

Files in this repository are numbered and named for ordering purposes only. At the top of each file is a section of metadata that denote what component the file belongs to and the default name & location of the file. Feel free to implement it however you want.

Note: some configuration files have hard-coded paths to my user directory -- fix it for your setup

Setup

@grafikchaos
grafikchaos / gist:9938618
Last active July 22, 2016 14:38 — forked from petemcw/gist:1169053
Magento Snippets

Magento Snippets

Add Attribute Group and Attributes to Attribute Sets

In an install script, you can follow the below example:

<?php
/**
 * Pan_JewelryDesigner Extension
@grafikchaos
grafikchaos / README.md
Last active December 25, 2015 12:59
Fixes issue in Markshust_Uspsav with getting data back from the USPS Address Verification API caused by using 9-digit zipcode instead of splitting it into their expected 5-digit and 4-digit values.

Overview


UPDATE #2:

Added the getApiEndpoint() method and overrode the uspsSubmitRequest() method in the Helper/Data.php. Basically cheating like crazy to get the domain name and it's IP address so our server will use that instead of the humanized domain name. This is a bandaid approach specific to our client and their internal DNS issues, so I wouldn't suggest using that getApiEndpoint() method unless absolutely necessary.


@grafikchaos
grafikchaos / puma.sh
Created September 27, 2013 04:13 — forked from runlevel5/puma.sh
#!/usr/bin/env bash
# Simple move this file into your Rails `script` folder. Also make sure you `chmod +x puma.sh`.
# Please modify the CONSTANT variables to fit your configurations.
# The script will start with config set by $PUMA_CONFIG_FILE by default
PUMA_CONFIG_FILE=config/puma.rb
PUMA_PID_FILE=tmp/pids/puma.pid
PUMA_SOCKET=tmp/sockets/puma.sock
set :stage, 'production'
set :shared_children, shared_children << 'tmp/sockets'
puma_sock = "unix://#{shared_path}/sockets/puma.sock"
puma_control = "unix://#{shared_path}/sockets/pumactl.sock"
puma_state = "#{shared_path}/sockets/puma.state"
puma_log = "#{shared_path}/log/puma-#{stage}.log"
namespace :deploy do
desc "Start the application"
@grafikchaos
grafikchaos / gist:6640682
Created September 20, 2013 17:09
Update DEFINER of database triggers in MySQL databases
perl -pi -e 's/DEFINER\=\`developer\`/DEFINER\=\`staging_user\`/g' my_database_dump_file.sql
@grafikchaos
grafikchaos / A_README.md
Last active December 22, 2015 20:19
How to patch MageParts ReorderProduct module to correctly compare Magento versions

We've had to patch this module several times for different projects because it is a useful module, just doesn't do version comparison correctly which can cause bugs. We submitted our code changes to MageParts developers and documented the errors we were experiencing with their module on a Magento EE 1.12.0.2 installation, but they have yet to incorporate our bug fixes — that's why I feel the need to document what the necessary changes are to be made to the module so that it works as expected.

This code is pulled from production code, so local package names have been replaced with "MYMOD" (or mymod_ for short codes or XML configuration files)

Pre-requisites:

  • Already have a successfully installed MageParts ReorderProduct module in the app/code/community directory
  • Have some familiarity with PHP and Magento application structure

.fluid-row {
div, section, article, li { /* Needs testing on li's */
&:first-child { /* using first child and margin-left for IE support */
margin-left: 0;
}
}
}
.fluid-column(@columns: 1, @offset: 0, @reset: default) {
.input-block-level();

Running Puma on Nginx

I use the latest Puma v1.4.0 from rubygems.

Make sure you have nginx installed with these options:

>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15

built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

@grafikchaos
grafikchaos / gist:5906014
Last active December 19, 2015 05:39
phpenv debug outpu for phpenv install --releases
☠ AA-L-JOSHJ:.phpenv $ phpenv install --releases |dev ✔ |
+ [phpenv:33] '[' -z '' ']'
+ [phpenv:34] PHPENV_ROOT=/Users/jjohnson/.phpenv
+ [phpenv:38] export PHPENV_ROOT
+ [phpenv:40] '[' -z '' ']'
++ [phpenv:41] pwd
+ [phpenv:41] PHPENV_DIR=/Users/jjohnson/.phpenv
+ [phpenv:50] export PHPENV_DIR
+ [phpenv:53] shopt -s nullglob
++ [phpenv:55] abs_dirname /Users/jjohnson/.phpenv/bin/phpenv