Skip to content

Instantly share code, notes, and snippets.

View theUniC's full-sized avatar

tλeUniC theUniC

  • Barcelona
View GitHub Profile
<?php
return array (
'birth_year' => '19BBY',
'created' => '2014-12-09T13:50:51.644000Z',
'edited' => '2014-12-20T21:17:56.891000Z',
'eye_color' => 'blue',
'films' =>
array (
0 => 'http://swapi.co/api/films/2/',
@theUniC
theUniC / Dockerfile
Created January 28, 2015 08:27
Dockerfile for Symfony
# Actually this is needed because on boot2docker it's not posible to write to a
# data volume or to a data-only volume container if the user who tryes to write does
# not have root permissions. This lines, should remain here until it does get fixed
# on boot2docker.
RUN useradd -m -u 1000 symfony
RUN echo "symfony ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/symfony
RUN chmod 0440 /etc/sudoers.d/symfony
<?php
// Votes are anonymous
abstract class Vote
{
abstract public function politicalParty();
}
/**
@theUniC
theUniC / first_exercice.php
Last active August 29, 2015 14:04
Soluciones formación doctrine
<?php
namespace Chinook\Store\Domain
{
interface ArtistRepository
{
public function findAll();
}
}
<?php
namespace Vendor\Context\DomainModel;
class Order
{
// ...
public function process()
{
@theUniC
theUniC / create_ramdisk.sh
Created May 1, 2014 09:44
Create and mount ramdisks on Mac OSX
#!/bin/sh
ramfs_size_mb=150
mount_point=~/var/tmp
mkramdisk() {
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'ram disk' ${ramdisk_dev}
mkdir -p ${mount_point}
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
@theUniC
theUniC / QueryBuilder.php
Last active August 29, 2015 13:59
Doctrine use of query builder
<?php
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityRepository;
class ProductRepository extends EntityRepository
{
public function findByAGivenASetOfUsersToSearchAndStatus(Collection $usersToSearch, $status)
{
$targetUserIds = $usersToSearch
@theUniC
theUniC / gist:9858373
Created March 29, 2014 17:18
Push output
$ git push --mirror [email protected]:atrapalo/framework.git
Counting objects: 812698, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (154287/154287), done.
remote: error: object bca5308fa04b1d43e47de77fc264a770ba9d2522:invalid author/committer line - bad email
remote: fatal: Error in object
Writing objects: 100% (812698/812698), 151.07 MiB | 100.00 KiB/s, done.
Total 812698 (delta 648291), reused 812698 (delta 648291)
error: unpack failed: index-pack abnormal exit
To [email protected]:atrapalo/framework.git
@theUniC
theUniC / Source.php
Created March 21, 2014 10:41
Sources
<?php
class Source
{
public const UNKNOWN = 1;
// Me la invento :)
public const ADWORDS = 2;
private $source;
@theUniC
theUniC / Country.php
Created February 7, 2014 07:36
Additional join columns
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Country
*
* @ORM\Table(name="country")