Skip to content

Instantly share code, notes, and snippets.

View matheusgontijo's full-sized avatar

Matheus Gontijo matheusgontijo

View GitHub Profile
@schmengler
schmengler / add-checkout-form-key.sh
Last active September 2, 2022 16:23
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@oivoodoo
oivoodoo / example
Created December 1, 2016 13:56
erlang remote debug
ssh -L 4369:localhost:4369 -L 9001:localhost:9001 ip -N
erl -name debug@127.0.0.1 -setcookie your_cookie -run observer
@molotovbliss
molotovbliss / mysql-large-db-import
Created November 29, 2016 18:05
Importing Large DB faster MySQL Settings
Source: https://dba.stackexchange.com/questions/83125/mysql-any-way-to-import-a-huge-32-gb-sql-dump-faster
innodb_buffer_pool_size = 4G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads = 16
innodb_flush_log_at_trx_commit = 0
Why these settings ?
innodb_buffer_pool_size will cache frequently read data
@Nav-Appaiya
Nav-Appaiya / gist:892d759c1749fb9241ce169afe213f68
Created September 6, 2016 08:55
Magento 2 get all attributes from the default products attribute set (id: 4)
<?php
/** @var $coll \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection */
$coll = $this->_objectManager->create(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class);
// add filter by entity type to get product attributes only
// '4' is the default type ID for 'catalog_product' entity - see 'eav_entity_type' table)
// or skip the next line to get all attributes for all types of entities
$coll->addFieldToFilter(\Magento\Eav\Model\Entity\Attribute\Set::KEY_ENTITY_TYPE_ID, 4);
$attrAll = $coll->load()->getItems();
@thagxt
thagxt / mage2-multiweb-subdir.md
Last active May 2, 2024 14:03
Set up Magento 2 multiple websites in sub directories

Set up Magento 2 multiple websites in sub directories

  1. Go to Admin > Stores > All Stores
  2. Click > Create Web Site
  3. In the Name field, enter store name.
    • e.g. Japan
  4. In the Code field, enter a unique string without spaces and > Save Web Site
    • e.g. super_jp
  5. Create Store
  6. Create Store View
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

alias Rebirth.Subscription
alias Ecto.Query
Subscription |> Query.where([s], not is_nil(s.user_id))
@fbrnc
fbrnc / AjaxLoader.ino
Last active May 3, 2018 00:22
Hardware AJAX Loader using an Attiny85, 3 potentiometers and a 24 RGB LED ring
#include <FastLED.h>
#define NUM_LEDS 24
#define NUM_DOTS 3
#define DATA_PIN 0
#define MAX_SPEED 60
using namespace std;
CRGB leds[NUM_LEDS];
@mmmries
mmmries / 00.Description.md
Last active August 18, 2019 12:26
3 Trvial Concurrency Examples in Elixir

These are my solutions to the three concurrency exercises from Katrina Owen's Go Post.

I'm posting here with example output in the hopes that someone call tell me how to do it better

@kinncj
kinncj / Dilmas.php
Last active June 6, 2017 13:54
Dilmas Currency
<?php
class Dilmas extends \SplFloat
{
public function __construct($value)
{
$currency = json_decode(file_get_contents('http://api.fixer.io/latest?base=USD&symbols=BRL'), true);
$brl =(float) $currency['rates']['BRL'];
parent::__construct(((float) round($value / $brl, 2)));