Skip to content

Instantly share code, notes, and snippets.

View vamsiikrishna's full-sized avatar
🎯

Vamsi Krishna B vamsiikrishna

🎯
  • Bengaluru - India
View GitHub Profile
@liuggio
liuggio / software-team-manifesto.md
Last active December 9, 2015 22:39
In the chaos of the implict, the tvision team creates this document with few concepts in order to unify the coding and some basic knowledge. If you are a developer and you are in the 2013 I think that you are already proficient with this notions. Please help me to improve this document forking the gist.
@jm
jm / toml.rb
Last active December 14, 2015 03:39
TOML. Because lol.
#######################
#
# THIS IS NOW A REAL GEM (and much improved...):
# https://github.com/jm/toml
#
#######################
require 'time'
@phansys
phansys / MyVendor_MyBundle_Cache_CacheInvalidator.php
Created March 14, 2013 20:06
Added basic comprobation to check valid entity keys.
<?php
namespace MyVendor\MyBundle\Cache;
/**
* Better than using
* $this->getDoctrine()->getManager()->getConfiguration()->getResultCacheImpl()->delete(...);
* in your controllers
*/
use Doctrine\ORM\Event\OnFlushEventArgs;
use Symfony\Component\DependencyInjection\ContainerAware;
@sheeep
sheeep / UserNamer.php
Last active February 25, 2016 13:19
A user namer for OneupUploaderBundle.
<?php
namespace Acme\DemoBundle;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Security\Core\SecurityContext;
use Oneup\UploaderBundle\Uploader\Naming\NamerInterface;
class UserNamer implements NamerInterface
{
@kbond
kbond / build.xml
Created May 10, 2011 14:23
Symfony2 ant build script template
<?xml version="1.0" encoding="UTF-8" ?>
<project name="[PROJECT_NAME]" default="build" basedir=".">
<property environment="env"/>
<loadfile property="version" srcfile="${basedir}/VERSION"/>
<condition property="bat" value=".bat" else="">
<os family="windows" />
</condition>
<target name="test">
<delete dir="${basedir}/build"/>
@havvg
havvg / base.json.twig
Created March 19, 2012 16:30
Symfony2 Twig JSON with JSONP
{% set jsonp = app.request.query.get('callback') %}
{% if jsonp %}{{ jsonp }}({% endif %}
{% block data %}{% if is_json|default(false) %}{{ data|raw }}{% else %}{{ data|json_encode|raw }}{% endif %}{% endblock %}
{% if jsonp %});{% endif %}
@jfairbank
jfairbank / wrap.js
Last active November 26, 2017 06:22
JS Wrap
function wrap(orig, newDef) {
return function(...args) {
return newDef.apply(this, [orig].concat(args));
};
}
myLib.getTotal = wrap(myLib.getTotal, function(orig, ...args) {
let total = orig.apply(this, args) * 0.8;
return total + this.getTax();
});
@ukd1
ukd1 / decrypt.sh
Created November 15, 2013 18:59
Super simple shell scripts we use at www.rainforestqa.com for encrypting / decrypting / updating our Heroku apps with private environment variables
#!/bin/bash
gpg qa.txt.asc
gpg staging.txt.asc
gpg production.txt.asc
@dbu
dbu / README.md
Last active October 2, 2018 11:57
Convert NelmioApiDocBundle annotations to Swagger PHP

A Symfony command to convert from NelmioApiDocBundle annotations to Swagger-PHP annotations.

This code is provided as is. Make sure to have your code committed to version control before running the command. Check if things work out and if not, use version control to reset the automated changes and fix the command.

@silviuvoicu
silviuvoicu / BookController.php
Created August 20, 2013 07:39
Spec with phpspec a symfony2 controller. I know which is the normal work flow: write first the spec, and then the code, but in order to understand better how to spec a symfony2 controller, I first create a simple book entity with just id and name, and then with the help of generators I created a crud system, which I modified a little. Then havin…
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Acme\DemoBundle\Entity\Book;