Skip to content

Instantly share code, notes, and snippets.

View birchestx's full-sized avatar

Jo Baker birchestx

  • ShipperHQ
  • Austin, TX
View GitHub Profile
@birchestx
birchestx / gist:3a26a61347cbe485677f
Created September 2, 2015 05:41
Mage::getStoreConfig in Magento 2 compared to Magento 1
Magento 1.x:
Mage::getStoreConfig('carriers/shipper/active')
Magento 2.x:
protected $scopeConfig;
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@birchestx
birchestx / simple_boot_tooltip_locale
Last active March 28, 2023 16:25
simple_form bootstrap with tooltips and locales
In simple_form_bootstrap.rb:
b.use :tooltip # enable the tooltip example from below.
I added these everywhere I saw word placeholder.
Add simple_form_components.rb:
module SimpleForm
module Components
@birchestx
birchestx / git_targets.xml
Created January 6, 2014 00:16
git targets for use with ant
<?xml version="1.0" encoding="UTF-8"?>
<project name="git_targets" basedir="." >
<!-- ===============================
Git tasks
==================================== -->
<macrodef name = "git">
<attribute name = "command" />
<attribute name = "dir" default = "" />
<element name = "args" optional = "true" />
<sequential>
@birchestx
birchestx / data_sort_checkbox
Created June 21, 2014 16:18
column sorting with datatables on checkbox
/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
return $.map( oSettings.oApi._fnGetTrNodes(oSettings), function (tr, i) {
return $('td:eq('+iColumn+') input', tr).prop('checked') ? '1' : '0';
} );
}
$('.ratemgr-table').dataTable({
@birchestx
birchestx / docker-cheat-sheet
Last active October 15, 2019 00:32
Docker cheat commands
#Build new Image (uses dockerfile in cwd)
docker build -t <your-desired-image-name> .
#Run Docker Container
docker run <image-name>
#Stop Docker Container (if you have used --name you can then stop with actual alias name)
docker stop <image-id>
#Show running Docker Images
@birchestx
birchestx / xdebug_php.ini
Created January 6, 2014 17:33
xdebug settings in php.ini
[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
@birchestx
birchestx / install_magento2_with_db
Last active December 15, 2017 17:22
Install script for magento2 with database, assumes you are running from www.localhost.com/20
#!/bin/bash
# Sets up a database with a magento2 installation. This assumes you are running from under your httpdocs/<release> location and have www.localhost.com in your /etc/hosts file
# To run type : install_magento2 <dirname> <password> <release>
# password is used for the datbase user and the magento admin password
if [ $# -eq 0 ]; then
echo "No arguments supplied"
echo "Usage: `basename $0` <dirname> <password> <release>"
echo "e.g install_magento2.sh mage2 password 21"
exit 1
View number of threads open
ps huH p <PID_OF_U_PROCESS> | wc -l
e.g. do ps huH p 2016 | wc -l ; sleep 1; done
@birchestx
birchestx / new_relic_tomcat.txt
Last active August 13, 2016 14:46
Setting up New Relic in Tomcat
1.Download Java agent zip file from New Relic site
2. Under the tomcat base directory create a directory newrelic
3. Put the unzipped files in this directory
4. Update the license key in newrelic.yml with that shown in New Relic Admin
5. Update the App Name to something suitable
6. Update catalina.sh to have following:
NR_JAR=/usr/local/tomcat/newrelic/newrelic.jar; export NR_JAR
CATALINA_OPTS="$CATALINA_OPTS -javaagent:$NR_JAR"; export CATALINA_OPTS
7. Restart Tomcat – should now appear as a new application in New Relic
@birchestx
birchestx / quick commands
Created August 10, 2016 00:49
magento 2 quick commands
XML Schema Resolution:
bin/magento dev:urn-catalog:generate .idea/misc.xml