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 / update_repos
Created October 28, 2014 00:57
Update all repos below cwd
ls -l | grep ^d | awk '{print $NF}' | xargs -n 1 bash -c 'cd $0; git pull'
@birchestx
birchestx / number_currency example
Created October 30, 2014 02:10
number_to_currency example
<%= f.input :handling_fee, label:"Flat Surcharge" , as: :string,
input_html: { value: number_to_currency(f.object.handling_fee, locale: :fr) } %>
In order for this to work I needed to add the gem rails-i18n
@birchestx
birchestx / change_currency_symbol_view
Created October 30, 2014 03:43
Change currency symbol on view Rails/JS
In Controller Setup:
@currency_symbol = Money::Currency.new(<model currency code>).symbol
In layout html:
<div id="currency_symbol" style="display:none"><%= @currency_symbol %></div>
In JS:
pkill -f my_pattern
e.g
pkill -f test.php
String text = new Scanner( new File("poem.txt") ).useDelimiter("\\A").next();
@birchestx
birchestx / magento2_install
Last active August 29, 2015 14:11
Installing Magento2 - The quick way
So we all hate reading docs. Here is the quick setup for installing Magento2. If you want the long route - http://devdocs.magento.com/
I'm assuming you have composer, PHP 5.4+ and MySQL5.6+. If you have MAMP installed time to go sort that as it wont work (MAMP is on MySQL5.5.x).
1. Install Composer - curl -sS https://getcomposer.org/installer | php
2. mv composer.phar /usr/local/bin/composer (might need to sudo)
3. Goto base httpdocs directory
4. git clone [email protected]:magento/magento2.git
5. Set permissions (like you do in Magento 1.x)
6. cd magento2
@birchestx
birchestx / mage2_directories
Last active June 3, 2016 05:36
Magento2 Major Directories
Ignoring frontend logic the important directories I can see so far are:
- app/code/Magento - Holds Magento implementation modules, e.g Customer, Cart, Checkout
- internal/Magento/Framework - Magento Framework e.g. Session Handling, SQL Setup, Cache
- pub/errors - Can move the local.xml.sample to local.xml so you don't have to keep looking in report directory!!
- vendor - 3rd Party libraries loaded via composer
- app/<module_vendor> - 3rd Party magento extensions
- app/etc/env.php - db credentials, replaces local.xml?
- var/cache, var/generation & var/page_cache - Delete these 3 directories to fully flush cache
@birchestx
birchestx / run_mage2_tests
Created January 11, 2015 17:14
Running Magento2 Unit tests
Firstly you need to ensure you have enough memory allocated else the script will fall over.
Edit php.ini and I found that setting memory_limit to 1028M was enough (default is 128M).
If you want to find your php.ini then you can look at phpinfo.php, or do:
php -i | grep php.ini
To run the tests goto base root folder and type:
Step 1: Open a Terminal window
Step 2: cd /Applications/Skype.app/Contents/MacOS/
Step 3: sudo ./Skype