Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View steverobbins's full-sized avatar

Steve Robbins steverobbins

View GitHub Profile
@mttjohnson
mttjohnson / dbsnapshot.sh
Last active February 25, 2020 12:01
MySQL DB snapshot separating tables into files for comparison purposes
#!/usr/bin/env bash
##
# Copyright © 2017 by Matt Johnson. All rights reserved
#
# Licensed under the Open Software License 3.0 (OSL-3.0)
# See included LICENSE file for full text of OSL-3.0
#
# https://github.com/mttjohnson
##
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.

@molotovbliss
molotovbliss / betterindexer.php
Last active May 1, 2017 20:37
Magento: only reindex invalidated indexes shell/indexer.php replacement
<?php
/**
* Add the parameter "reindexallrequired" to only index the indexers
* that are in need of processing to avoid doing full reindexes
* that disregard the state of the index as indexer.php does
*
* Usage:
* php shell/betterindexer.php reindexallrequired
*
* http://magento.stackexchange.com/a/62272/69
@piotrekkaminski
piotrekkaminski / gist:9bc45ec84028611d621e
Last active August 8, 2023 08:38
How to automatically download patches and release of Magento
1) First you need to generate download token. Login to your account on magento.com and generate it in Account Settings->Downloads Access Token
2) You will need your MAGEID as well. It is shown at the top-left in your account page.
3) curl -k https://MAGEID:TOKEN@www.magentocommerce.com/products/downloads/info/help
4) Profit!
@gwillem
gwillem / magento-nginx.conf
Last active July 29, 2023 10:13
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
@vpietri
vpietri / datataflow.php
Last active June 19, 2020 16:09
Magento shell script to run dataflow from the command line
<?php
require_once 'abstract.php';
/**
* Magento Dataflow Shell Script
*
* This file should be save in the shell directory of Magento
* Basic usage samples:
* php dataflow.php
* php dataflow.php list
@mpchadwick
mpchadwick / Mpchadwick_Missing_Acl_Checker.php
Created July 11, 2015 03:42
Mpchadwick_Missing_Acl_Checker.php
<?php
require_once 'abstract.php';
/**
* Generate a CSV of modules with admin routes that haven't implemented _isAllowed()
*/
class Mpchadwick_Missing_Acl_Checker extends Mage_Shell_Abstract
{
const MODULES_PATH = 'modules';
@raybogman
raybogman / SupportDesk_FixAcl.php
Last active July 6, 2018 19:00
SupportDesk_FixAcl
<?php
/**
* SupportDesk_FixAcl.php v1.1
* SupportDesk (www.supportdesk.nu)
* 10/7/2015
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* It is available through the world-wide-web at this URL:
@steverobbins
steverobbins / magento-ioncube-module-info.php
Last active May 12, 2021 21:32
Display what information we can about Magento1 objects that are ioncubed (or any class really)
<?php ini_set('display_errors', 1) ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<?php
// we need the autoloader
include 'app/Mage.php';
$classes = array(
<?php
/**
* Generate modman file from Magento Connect 2.0 package.xml
*
* Usage:
*
* php package2modman.php path/to/package.xml > path/to/modman
*
*/
require_once(__DIR__ . "/../www/app/Mage.php");