Skip to content

Instantly share code, notes, and snippets.

View sta1r's full-sized avatar

Alastair Mucklow sta1r

  • Dotdigital
  • Croydon
View GitHub Profile
@sta1r
sta1r / mac.txt
Last active June 9, 2021 16:17
MacOS vs Ubuntu, sed for composer replace
sed -i '' '/"extra"/ i\\
"replace": {\
"dotmailer/dotmailer-magento2-extension": "*",\
"dotmailer/dotmailer-magento2-extension-chat": "*",\
"dotmailer/dotmailer-magento2-extension-enterprise": "*",\
"dotmailer/dotmailer-magento2-extension-sms": "*",\
"dotmailer/dotmailer-magento2-extension-b2b": "*"\
},
' composer.json
@sta1r
sta1r / spooky.php
Created October 30, 2020 13:01
Halloween Code Golf
<?php
class Spooky
{
static $halloweenWords = ["apparition","bat","bloodcurdling","bloodsucker","bloody","bones","boogeyman","broomstick","cadaver","carved","cauldron","cemetery","chainsaw","cobweb","coffin","corpse","crypt","cursed","decapitated","decomposing","demon","dotdigital","enchanted","evil","exorcism","fangs","ghost","ghoulish","goblin","gory","gravestone","graveyard","grim","gruesome","halloween","happy","haunted","haunting","howling","incantation","knife","levitation","lurking","medium","monsters","mummified","mummy","occult","orbs","paranormal","petrified","phantom","pitchfork","poltergeist","possessed","reanimated","ritual","satanic","scary","screaming","shadow","shaking","skeleton","skull","sorcery","specter","spell","spider","spirit","spooked","terrified","terror","toad","trembling","troll","undead","unearthly","vampire","werewolf","witchcraft","wizard","wraith","zombie"];
static $outputPhrase = '';
public static function decipher($c)
{
@sta1r
sta1r / magento-config.md
Last active January 3, 2020 12:10
Configuration CLI commands for a Magento local development environment

Please note these are designed to remove hurdles when starting up or re-installing a local Magento environment, and are not for production use.

bin/magento deploy:mode:set developer
bin/magento config:set admin/captcha/enable 0
bin/magento config:set admin/security/session_lifetime 604800
@sta1r
sta1r / dotdigital.dic
Last active September 11, 2019 15:42
Dotdigital connector dictionary for IDEs
dotmailer
dotdigital
Dotdigitalgroup
adminhtml
passcode
salesrule
wishlist
wishlists
smtp
dmpt
@sta1r
sta1r / connector.log
Last active July 25, 2019 09:22
Connector log types
[2019-07-16 14:37:57] dotdigital.INFO: Failed to register with IMPORTER. Type(Catalog) / Scope(Bulk) / Store(2) / Product Ids() [] []
[2019-07-16 14:37:57] dotdigital.INFO: Failed to register with IMPORTER. Type(Catalog) / Scope(Bulk) / Store(2) / Product Ids() [] []
[2019-07-16 14:41:09] dotdigital.ERROR: Error fetching customer or scope data for Chat {"code":0,"message":"Notice: Undefined property: Dotdigitalgroup\\Email\\Model\\Chat\\Api\\Requests\\UpdateProfile::$profileId in /Users/alastairmucklow/Sites/magento2/app/code/Dotdigitalgroup/Email/Model/Chat/Api/Requests/UpdateProfile.php on line 42"} []
[2019-07-16 14:41:09] dotdigital.ERROR: Cron Job ddg_automation_importer has an error [] []
[2019-07-16 14:45:24] dotdigital.DEBUG: syncByStore {"69":{"id":"69","name":"Chaz Kangeroo Hoodie","sku":"MH01","status":"[object] (Magento\\Framework\\Phrase: \"Enabled\")","visibility":"Catalog, Search","price":100,"specialPrice":0,"categories":[{"Id":"2","Name":"Default Category"},{"Id":"21","Name":"Hoodies & Sweats
@sta1r
sta1r / profiler.php
Created July 12, 2019 14:43
M1 database query profiler
$profiler = Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler();
$profiler->setEnabled(true);
/*
*
*
*
* Code to be analysed
*
*
*
@sta1r
sta1r / timer.php
Created July 12, 2019 14:42
Timed script execution
// Start of code block to be timed
$start = microtime(true);
// End of timed section
$time_elapsed_secs = microtime(true) - $start;
Mage::helper('ddg')->log($time_elapsed_secs);
@sta1r
sta1r / orders.xml
Created March 14, 2017 11:43
EA order demo
<Orders>
<Order>
<OrderId>MON-FDMLROKCGQ</OrderId>
<OrderNumber>5jcrck0n</OrderNumber>
<OrderDate>2017-03-14 11:40:49</OrderDate>
<OrderStatus>New order</OrderStatus>
<BillingFirstName>Alastair</BillingFirstName>
<BillingLastName>Mucklow</BillingLastName>
<BillingFullName>Alastair Mucklow</BillingFullName>
<BillingCompany/>
@sta1r
sta1r / endpoints.md
Last active January 4, 2017 16:05
Monocle 24 Radio API

Monocle 24 Radio JSON API

Latest episode (what's on now)

http://api.monocle.com/radio/

All active shows

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="https://s0.2mdn.net/ads/studio/cached_libs/createjs_2015.11.26_54e1c3722102182bb133912ad4442e19_min.js"></script>
<script type="text/javascript" src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>
<script type="text/javascript" src="model.min.js"></script>
<script type="text/javascript">