Skip to content

Instantly share code, notes, and snippets.

View ornj's full-sized avatar
💬
typing…

Stephen Hurwitz ornj

💬
typing…
View GitHub Profile
@ornj
ornj / PollRespondType.php
Created December 7, 2012 21:18
Using reference to entity in query_builder option
<?php
namespace Acme\PollBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Acme\PollBundle\Entity\FieldRepository;
@ornj
ornj / AbstractContent.php
Created December 4, 2012 20:24
Using fetch="EAGER" to cut down on trips to the database
<?php
namespace Acme\ContentBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="Acme\ContentBundle\Entity\AbstractContentRepository")
* @ORM\Table(name="content")
* @ORM\HasLifecycleCallbacks
@ornj
ornj / TourRepository.php
Created November 28, 2012 19:32
Query for Doctrine entity that contains specified entity in a unidirectional ManyToMany relationship
<?php
namespace Acme\TourBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NoResultException;
/**
* TourRepository
*/
@ornj
ornj / gist:4120764
Created November 20, 2012 20:18
form data
public '__CLASS__' => string 'Cisneros\ArtworkBundle\Entity\Artwork' (length=37)
public 'object_number' => string '1988.18' (length=7)
public 'title_en' => string 'Physichromie No. 500' (length=21)
public 'title_es' => string 'Physichromie No. 500' (length=21)
public 'width' => string '484.0' (length=5)
public 'height' => string '8.0' (length=3)
public 'length' => string '183.0' (length=5)
public 'room' => string '101' (length=3)
public 'medium_en' => string 'Casein paint on PVC and acrylic on plywood sheets' (length=49)
public 'medium_es' => string 'Pintura de caseina sobre PVC y láminas de acrílico sobre contrachapado' (length=72)
@ornj
ornj / form data
Created November 20, 2012 20:15
Form Data
object(stdClass)[1332]
public '__CLASS__' => string 'Cisneros\ArtworkBundle\Entity\Artwork' (length=37)
public 'object_number' => string '1988.18' (length=7)
public 'title_en' => string 'Physichromie No. 500' (length=21)
public 'title_es' => string 'Physichromie No. 500' (length=21)
public 'width' => string '484.0' (length=5)
public 'height' => string '8.0' (length=3)
public 'length' => string '183.0' (length=5)
public 'room' => string '101' (length=3)
public 'medium_en' => string 'Casein paint on PVC and acrylic on plywood sheets' (length=49)
@ornj
ornj / constraint.php
Created November 20, 2012 19:59
non-working constraint
public function buildForm(FormBuilderInterface $builder, array $options) {
$subscriber = new AddDateFieldSubscriber($builder->getFormFactory());
$builder->addEventSubscriber($subscriber);
$builder
->add('images', 'collection', array(
'type' => new UploadType(),
'required' => true,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
@ornj
ornj / GPTMCMap.js
Created July 13, 2012 15:26
GPTMC Interactive Map
(function($) {
/**
* GPTMC Map Animation by Bluecadet, 2012
* http://www.bluecadet.com
*
* Copyright (c) 2012 Bluecadet
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@ornj
ornj / plugin.js
Created July 2, 2012 14:01
jQuery Plugin Template
(function($) {
var methods = {
init: function(options) {
return this; // Always return this to maintain ability to chain functions together
},
update: function(options) {
return this;
},
destroy: function() {
return this; // I guess
@ornj
ornj / FixPermissions.sh
Created March 26, 2012 16:05
Quick permissions fix for new Symfony 2 projects. Replace user `www` on line 4 with apache's user.
rm -rf app/cache/*
rm -rf app/logs/*
sudo chmod +a "www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
@ornj
ornj / kickstart.make
Created July 20, 2011 17:20
Make file for Drupal 7 kickstart installation
; Core version
; ------------
; Each makefile should begin by declaring the core version of Drupal that all
; projects should be compatible with.
core = 7.x
; API version
; ------------
; Every makefile needs to declare its Drush Make API version. This version of