Skip to content

Instantly share code, notes, and snippets.

View mmenozzi's full-sized avatar
💻
CTO at Webgriffe®

Manuele Menozzi mmenozzi

💻
CTO at Webgriffe®
View GitHub Profile
@mmenozzi
mmenozzi / .gitignore
Created June 24, 2014 08:23
Magento gitgnore
/.idea
/bin/config.sh
# Magento
/magento/var/*
!/var/.htaccess
/magento/media/*
/magento/app/etc/local.xml
/magento/downloader/.cache
/magento/downloader/cache.cfg
@mmenozzi
mmenozzi / dev_install.sh
Created June 24, 2014 07:43
Magento Dev Install
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MAGENTO_DIR="${SCRIPT_DIR}/.."
COMPOSER_DIR=${MAGENTO_DIR}
source ${SCRIPT_DIR}/config.sh
cd ${MAGENTO_DIR}
@mmenozzi
mmenozzi / xhprof.php
Last active August 29, 2015 14:01
Profiling with xhprof
$profilingEnabled = extension_loaded('xhprof') && isset($_GET['xhprof']);
if ($profilingEnabled) {
include_once '/Users/manuele/Work/Projects/xhprof-0.9.3/xhprof_lib/utils/xhprof_lib.php';
include_once '/Users/manuele/Work/Projects/xhprof-0.9.3/xhprof_lib/utils/xhprof_runs.php';
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
register_shutdown_function(
function() {
$profiler_namespace = 'xxx'; // namespace for your application
$xhprof_data = xhprof_disable();
$xhprof_runs = new XHProfRuns_Default();
<?php
/**
* @author Manuele Menozzi <[email protected]>
*/
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
<?php
/**
* @author Manuele Menozzi <[email protected]>
*/
class VendingMachine
{
private $availableItems = array('coffe' => 0.38);
private $credit = 0;
<?php
/**
* @author Manuele Menozzi <[email protected]>
*/
include 'VendingMachine.php';
class VendingMachineTest extends PHPUnit_Framework_TestCase
{
/**
<?php
/**
* @author Manuele Menozzi <[email protected]>
*/
namespace Erica\EricaBundle\EventListener;
use Doctrine\Common\EventArgs;
use Gedmo\Timestampable\TimestampableListener;
@mmenozzi
mmenozzi / iterm-fit-and-set-bg
Created August 2, 2013 06:45
Script that resizes and crop an image and then sets as background for iTerm
#!/bin/bash
# Script that resizes and crop an image and then sets as background for iTerm
# First, check to see if we have the correct terminal!
if [ "$(tty)" == 'not a tty' ] || [ "$TERM_PROGRAM" != "iTerm.app" ] ; then
exit $?
fi
# Console dimensions
@mmenozzi
mmenozzi / Sostituzione disco in RAID con grub install.md
Last active April 17, 2020 14:52
Sostituzione disco in RAID con grub install

Sostituzione disco in RAID con grub install

Si assume che il disco da sostituituire sia /dev/sda mentre il disco buono sia /dev/sdb.

Rimozione del disco dall array RAID

Innanzi tutto, se non ancora stato fatto, è necessario marcare come fallito e poi rimuovere il disco /dev/sda/ dall'array RAID.

@mmenozzi
mmenozzi / NotificationSender.php
Created February 16, 2013 14:56
APNS Payload
$body = array(
'aps' => array(
'alert' => $message,
'badge' => 1,
'sound' => 'default'
)
);
if (!is_null($section)) {
$body['section'] = $section;