Skip to content

Instantly share code, notes, and snippets.

@kriswallsmith
kriswallsmith / test.php
Last active December 20, 2015 00:29
A test harness for your Symfony2 project. Runs functional tests in chunks.
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInput as Input;
use Symfony\Component\Console\Input\InputOption as Option;
require_once __DIR__.'/../vendor/autoload.php';
/** Outputs and runs a command. */
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 5, 2025 13:05
A badass list of frontend development resources I collected over time.
@makasim
makasim / gist:3720535
Last active June 26, 2017 06:32
form partial bind
<?php
namespace Foo\CoreBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormInterface;
/**
* Changes Form->bind() behavior so that it treats not set values as if they
@jverdeyen
jverdeyen / gist:3118544
Created July 15, 2012 20:41
Webistrano : Symfony2 Recipe
require 'yaml'
require "fileutils"
require "zlib"
#STDOUT.sync
$error = false
$pretty_errors_defined = false
# Be less verbose by default
#logger.level = Logger::IMPORTANT
@snc
snc / buildBootstrap.sh
Created April 25, 2012 10:28
Symfony 2.0.x with composer
#!/bin/sh
cd `dirname $0`
if [ -d "../vendor/symfony/symfony" ]; then
cd "../"
fi
ROOT=`pwd`
cd vendor/symfony && ln -s symfony/src
@peterjmit
peterjmit / deploy.rb
Created April 10, 2012 13:45
Create a parameters.ini file interactively when deploying with capifony
# This custom task for deploying a Symfony 2 application is set to run after deploy:setup
# is executed. It interactively ask a user for database details to create a parameters.ini
# thus avoiding having to manually on to the server and create it
#
# Helper function from http://stackoverflow.com/a/1662001/1041885
#
# Interactive parameter.ini generation adapted from http://adurieux.blogspot.co.uk/2011/10/using-capistrano.html
# ...
# ... Your deployment settings/tasks
@gre
gre / easing.js
Last active May 9, 2025 01:18
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
# Cookbook Name:: mongodb
# Recipe:: default
case node['platform']
when "ubuntu"
execute "apt-get update" do
action :nothing
end
execute "add gpg key" do
@perusio
perusio / gist:1497464
Created December 19, 2011 14:32
How to have an "inline" robots.txt for development/private setups
## Here's the way to have Nginx return a robots.txt file that disallows all crawling by bots.
## This is useful for development and private sites.
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /\n";
}
@arnaud-lb
arnaud-lb / RelDate.php
Created December 4, 2011 14:12
4 lines relative date formatter with DateInterval and Symfony2 Translator
<?php
use Symfony\Component\Translation\TranslatorInterface;
function format(\DateTime $date, TranslatorInterface $translator)
{
$diff = date_create()->diff($date);
$seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s;
$format = $translator->transChoice('reldate', $seconds);