Skip to content

Instantly share code, notes, and snippets.

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 / 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
@coma
coma / annotation
Created February 10, 2013 10:47
repo sample
/**
* @ORM\Entity(repositoryClass="Comakai\TicketsBundle\Repository\TicketRepository")
*/
class Ticket...
/**
* @ORM\OneToMany(targetEntity="Picture", mappedBy="gallery", cascade={"persist", "remove"})
*/
private $pictures;
public function setPictures($pictures) {
$this->getPictures()->clear();
foreach ($pictures as $picture) {
$this->addPicture($picture);
}
}
@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;
(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();