Skip to content

Instantly share code, notes, and snippets.

@rob-murray
rob-murray / siege_examples.sh
Last active April 1, 2024 03:48
Siege examples
# Basic example
siege -t60s -c20 -d10 'http://robertomurray.co.uk/'
# Basic auth;
auth=$(echo -n 'username:password' | openssl base64)
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/'
@hapticdata
hapticdata / Makefile
Created April 26, 2014 19:24
use a Makefile to run ssh commands on a vagrant box
SERVER_DIR=/var/www/host/server
CONSOLE=$(SERVER_DIR)/app/console
update:
vagrant ssh -- "cd $(SERVER_DIR) && \
sudo composer selfupdate -n -v && \
composer install -n -v"
cache:
vagrant ssh -- "$(CONSOLE) doctrine:migrations:migrate -n && \
<?php
namespace Acme\DemoBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class DoctrineEntityListenerPass implements CompilerPassInterface
{
@m-radzikowski
m-radzikowski / TruncateHtmlExtension.php
Created July 2, 2013 19:13
Twig Filter for Symfony 2 - truncate HTML string without stripping tags after reach the minimum length of displayed text
<?php
/**
* Twig Filter for Symfony 2 - truncate HTML string without stripping tags after reach the minimum length of displayed text
* Truncates only first-level tags after reach the minimum, so returned text will be >= minimum
* Works well with (only?) utf-8 encoding.
*
* Installation:
* 1. Add this file to your bundle into src/Acme/DemoBundle/Twig/TruncateHtmlExtension.php
* 2. Update namespace, if your bundle isn't Acme/DemoBundle
* 3. Register it in app/config.yml:
#!/bin/bash
# CREATE BACKUPS BEFORE RUNNING THIS SCRIPT!
for m in $(locate Mage.php | grep -v downloader); do
cd $(dirname $(dirname $m)) || (echo && continue) # old locate db
MAGE_VERSION=$(php -d error_reporting=0 -r "require 'app/Mage.php'; Mage::app(); echo Mage::getVersion();")
if echo $MAGE_VERSION | egrep -q "^[0-9.]+$"; then
if [ $MAGE_VERSION "<" 1.4.0.0 ] || [ $MAGE_VERSION ">" 1.7.0.1 ]; then
echo -e "No patch available for version $MAGE_VERSION in $(pwd)\n"
@aschroder
aschroder / gist:2469319
Created April 23, 2012 07:17
Magento REST API PHP test harness (admin and customer)
<?php
/**
* Copyright Magento 2012
* Example of products list retrieve using Customer account via Magento
REST API. OAuth authorization is used
*/
$callbackUrl = "http://yourhost/oauth_customer.php";
$temporaryCredentialsRequestUrl =
"http://magentohost/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
@oodavid
oodavid / README.md
Last active June 12, 2024 00:28 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@petemcw
petemcw / magento_sql_snippets.md
Created July 21, 2011 19:41
Magento SQL Snippets

Magento SQL Snippets

Clear Temporary Data Tables

TRUNCATE `log_customer`;
TRUNCATE `log_quote`;
TRUNCATE `log_summary`;
TRUNCATE `log_url`;
TRUNCATE `log_url_info`;