Skip to content

Instantly share code, notes, and snippets.

(function($){
$.fn.comaCollection = function(){
var args = Array.prototype.slice.call(arguments);
if(args.length > 0 && typeof(args[0]) == 'string') {
var api = $(this).data('comaCollection');
var method = args.shift();
@coma
coma / Datagrid.php
Created May 31, 2012 15:47
Datagrid
<?php
namespace Comakai\AdminBundle\Component;
use Comakai\AdminBundle\Comun\CRUDController,
Pagerfanta\Pagerfanta,
Pagerfanta\Adapter\DoctrineORMAdapter,
Comakai\AdminBundle\Form\SearchType,
Symfony\Component\HttpFoundation\Cookie,
Doctrine\ORM\QueryBuilder;
public function setPictures($pictures) {
$this->getPictures()->clear();
foreach ($pictures as $picture) {
$this->addPicture($picture);
}
}
/**
* @ORM\OneToMany(targetEntity="Picture", mappedBy="gallery", cascade={"persist", "remove"})
*/
private $pictures;
@coma
coma / annotation
Created February 10, 2013 10:47
repo sample
/**
* @ORM\Entity(repositoryClass="Comakai\TicketsBundle\Repository\TicketRepository")
*/
class Ticket...
@coma
coma / ProjectRepository
Created February 10, 2013 10:59
service injection in repo
<?php
namespace Comakai\TicketsBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Comakai\TicketsBundle\Entity\User;
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\Security\Core\SecurityContext;
class ProjectRepository extends EntityRepository
if (ret == MPG123_NEW_FORMAT) {
var format = binding.mpg123_getformat(mh);
debug('new format!', format);
self.emit('format', format);
var positionTimeIntervalID = setInterval(function() {
var current = binding.mpg123_tellframe(mh);
var total = binding.mpg123_length(mh);
@coma
coma / AppKernel.php
Created March 20, 2013 16:06
Idea para solucionar el problema de los plurales en castellano para Symfony.
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Doctrine\Common\Inflector\Inflector;
class AppKernel extends Kernel
{
public function __construct($environment, $debug)
{
Inflector::rules('singular', [
'/(d|n|r|s)es$/i' => '\1\2',
(function($, _, undefined) {
var resetTime = function(m) {
return m.hour(0).minute(0).second(0);
};
$.fn.CalendarWidget = function(options) {
var pluginName = 'CalendarWidget';
$(function() {
$('#basic').MomentPicker();
});