Skip to content

Instantly share code, notes, and snippets.

@odracci
odracci / gist:458452
Created June 30, 2010 09:19 — forked from cirpo/gist:457991
Fix symfony td_actions
#sf_admin_container ul.sf_admin_td_actions li a {
padding-left:20px;
padding-top: 3px;
}
@odracci
odracci / .bashrc
Created March 18, 2012 13:49 — forked from trumbitta/.bash_aliases
My version with tweaks and inspiration from holman/dotfiles
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_unpushed {
local unpushed=`/usr/bin/git cherry -v origin/$(get_git_branch) 2> /dev/null`
[[ "$unpushed" != "" ]] && echo "$(tput setaf 1) ++> $(tput sgr0)"
}
@odracci
odracci / Vagrantfile
Created June 22, 2012 07:31
vagrant and puppet files for making a mongodb dev environment
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
config.vm.network :hostonly, "10.0.0.2"
config.vm.forward_port 27017, 27017
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "."
puppet.manifest_file = "puppet.pp"
end
end
@odracci
odracci / Puppet config snippet to define a Launchpad PPA
Created June 22, 2012 07:31 — forked from blueyed/Puppet config snippet to define a Launchpad PPA
This defines pparepo which allows to add a PPA (Personal Package Archive) repository from Launchpad to a client. It uses apt::key, which I have taken (and maybe modified) from http://projects.puppetlabs.com/projects/1/wiki/Apt_Keys_Patterns (blog post at
# Setup a PPA repo, where the name is "user/ppaname", e.g. "blueyed/ppa" ("ppa" being the default)
define pparepo($apt_key = "", $dist = $ppa_default_name, $supported = ["lucid", "hardy"], $ensure = present, $keyserver = "keyserver.ubuntu.com") {
$name_for_file = regsubst($name, '/', '-', 'G')
$file = "/etc/apt/sources.list.d/pparepo-${name_for_file}.list"
file { "$file": }
case $ensure {
present: {
if ($dist) and ($dist in $supported) {
File["$file"] {
@odracci
odracci / DemoController.php
Created July 1, 2012 23:32 — forked from havvg/DemoController.php
Impersonating a User in Symfony2
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Role\SwitchUserRole;
@odracci
odracci / TranslatedFieldType.php
Created July 27, 2012 19:40 — forked from pakaufmann/TranslatedFieldType.php
Changed a couple of things. Languages are now dynamic and a default language can be used which won't be written into a translation object but directly into the object itself so it can be used like in this blog post: http://knplabs.fr/blog/I%28blah...blah.
<?php
namespace ExampleBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Edge5\TestProjectBundle\Form\addTranslatedFieldSubscriber;
@odracci
odracci / deploy.rb
Created September 26, 2012 22:46 — forked from jakzal/deploy.rb
Updating assets version before assetic dump (capifony)
namespace :symfony do
namespace :assets do
desc "Updates assets version"
task :update_version do
run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/app/config/config.yml"
end
end
end
before "symfony:assetic:dump" do
@odracci
odracci / README.markdown
Created November 20, 2012 16:47 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@odracci
odracci / gist:4356918
Last active December 10, 2015 01:18 — forked from stefanosala/gist:3881637
NameVirtualHost *:80
<VirtualHost *:80>
ServerName dev.lan
ServerAlias *.dev.lan
DocumentRoot /Users/rick/projects/php
<Directory /Users/rick/projects/php>
#AllowOverride All
AllowOverride None
<?php
namespace Nelmio\HomeBundle\Tests\Controller;
use Nelmio\HomeBundle\Controller\ContactController;
use Liip\FunctionalTestBundle\Test\WebTestCase;
class ContactControllerTest extends WebTestCase
{
public function testEmail()