Skip to content

Instantly share code, notes, and snippets.

View cranberyxl's full-sized avatar

Andy Stanberry cranberyxl

  • Lancaster, UK
  • 20:21 (UTC +01:00)
View GitHub Profile
#defaults hack
defaultWithoutSlash:
pattern: /checkout
defaults: { _bundle: CheckoutBundle, _controller: Checkout, _action: default }
defaultWithSlash:
pattern: /checkout/
defaults: { _bundle: CheckoutBundle, _controller: Checkout, _action: default }
default:
#!/bin/bash
kicker -e "phpunit $1" $1 ../$1
<?php
$filename = "/Andy.jpg";
$min = 800;
list($width, $height) = getimagesize($filename);
$source = imagecreatefromjpeg($filename);
$max = max($height, $width);
if ($min != null && $min > $max) {
<?php
namespace Symfony\Component\Validator\Constraints;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.4.tar.gz/from/this/mirror'
homepage 'http://php.net/'
<?php
public function testFoo()
{
$order = new Order();
$order->setBillingAddress($this->createAddress('billing'));
$order->setBillingAddress($this->createAddress('shipping'));
}
@cranberyxl
cranberyxl / gist:830331
Created February 16, 2011 21:58
Use sessions across client requests
<?php
class YourTestKernel extends \yourKernel
{
protected $session;
protected function initializeContainer()
{
parent::initializeContainer();
<?php
class CachedClassMetadata extends ClassMetadata
{
private $filemtime;
public function setFilemtime($filemtime)
{
$this->filemtime = $filemtime;
}
@cranberyxl
cranberyxl / gist:2483417
Created April 24, 2012 20:24
How to download a github private tarball
curl -o {tag}.tgz -Lu "{githubuser}:{githubpassword}" https://github.com/{githubuser}/repo/tarball/{tag}
$ traceroute www.rr.com
traceroute to www.rr.com (24.28.199.168), 64 hops max, 52 byte packets
1 cpe-24-90-20-1 (24.90.20.1) 62.247 ms 28.031 ms 49.303 ms
2 gig-0-3-0-11-nycmnytf-rtr1.nyc.rr.com (24.29.151.193) 31.817 ms 36.352 ms 47.873 ms
3 bun106.nyquny91-rtr001.nyc.rr.com (184.152.112.99) 18.988 ms 29.686 ms 54.856 ms
4 bun6-nyquny91-rtr002.nyc.rr.com (24.29.148.254) 20.046 ms 23.258 ms 36.638 ms
5 ae-3-0.cr0.nyc20.tbone.rr.com (66.109.6.76) 51.327 ms 34.407 ms 14.770 ms
6 ae-0-0.cr0.nyc30.tbone.rr.com (66.109.6.26) 40.519 ms 81.203 ms 25.858 ms
7 ae-4-0.cr0.dca20.tbone.rr.com (66.109.6.28) 63.897 ms
66.109.9.30 (66.109.9.30) 47.622 ms 36.541 ms