Skip to content

Instantly share code, notes, and snippets.

🏍

Jose Ruzafa jruzafa

🏍
Block or report user

Report or block jruzafa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jruzafa
jruzafa / Documentation.md
Created Oct 8, 2019 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)
View Documentation.md

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@jruzafa
jruzafa / curl.md
Created Oct 8, 2019 — forked from subfuzion/curl.md
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@jruzafa
jruzafa / magento2-truncate.sql
Created Jun 12, 2019 — forked from rafaelstz/magento2-truncate.sql
Magento 2 truncate customers, products, reviews and orders table
View magento2-truncate.sql
SET FOREIGN_KEY_CHECKS = 0;
-- Truncate order tables
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
View google_spreadsheet_double_quotes_formula.txt
Export spreadsheet as csv.
=ArrayFormula(""""&Sheet1!A:B&"""")
Open with sublime;
1.Replace """" with ""
2.Replace """ with "
source: http://stackoverflow.com/questions/3315636/how-to-enclose-every-cell-with-double-quotes-in-google-docs-spreadsheet
View debugging.md

Debugging (Resource) Model Instantiation

Follow each step manually and any bugs during (resource) model instantiation will become obvious.

Since many people find model and resource model instantiation to be one of the more challenging things in Magento 1, these are all the steps Magento does to resolve the factory name to the real PHP class name.

To debug, simply follow each step manually until you find a non-match. This works really well in my experience.
Less guessing, more and faster results.

In the examples I use a factory name of "example/thing".

@jruzafa
jruzafa / php_snippets.php
Last active Mar 13, 2019
Php snippets #php #snippets
View php_snippets.php
<?php
$csv = array_map('str_getcsv', file($file));
array_walk($csv, function(&$a) use ($csv) {
$a = array_combine($csv[0], $a);
});
array_shift($csv); # remove column header
// Format price
//
You can’t perform that action at this time.