Skip to content

Instantly share code, notes, and snippets.

@dbu
dbu / Vagrantfile
Created November 13, 2012 09:26
vagrant setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
this_dir = File.dirname(__FILE__) + "/"
require this_dir + "vagrant/hostmaster.rb"
Vagrant::Config.run do |config|
# define some colors for our output
def colorize(text, color_code) "#{color_code}#{text}\033[0m" end
@lgrz
lgrz / deploy.rb
Created August 7, 2012 00:43
Collection of Capifony tasks
after "deploy:restart", "deploy:cleanup"
after "deploy:setup", "symfony:setup:parameters_init"
# Clear the cache before the cache:warmup task is run. The cache directory is
# shared, that way setting ACL's only happens once and we avoid the use of
# sudo
before 'deploy:finalize_update', 'symfony:cache:remove'
namespace :symfony do
namespace :cache do
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }
@beberlei
beberlei / MyWebTestCase.php
Created September 17, 2011 12:14
Easily Inject authenticated Symfony User into functional test
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/
@beberlei
beberlei / Document.php
Created May 18, 2011 10:46
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{
/*
* ShortCut
* Mini routing for jQuery
*/
(function($){
$.shortCut = function(settings){
var defaults = {
controller: false,
init: false,
element: $('body'),
@lgrz
lgrz / db_add
Created February 5, 2010 04:00
bash scripts - apache, mysql
#!/usr/bin/env bash
#
# db_add
# A script to configure a new database
#
if [[ $# -lt 2 ]]
then
echo "usage: db_add <db-name> <db-server> [db-host]"
echo "example 1 connect from localhost: db_add \"db-name\" \"db-server\" \"localhost\""