Skip to content

Instantly share code, notes, and snippets.

Jose Ruzafa jruzafa

View GitHub Profile
View server_services.sh
echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install bashtop
View regexp.md

^[A-Za-z]+[A-Za-z0-9.\s]+$

@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.

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.