Skip to content

Instantly share code, notes, and snippets.

View sstok's full-sized avatar
🎯
Focusing

Sebastiaan Stok sstok

🎯
Focusing
View GitHub Profile
@beberlei
beberlei / Document.php
Created May 18, 2011 10:46
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{
@cowlby
cowlby / collection_widget.twig
Created October 17, 2011 23:32
Customizing form collections in Symfony2
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
<?php
namespace Acme\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="folder")
*/
@lavoiesl
lavoiesl / CommentsAcl.php
Created August 21, 2012 04:04
Workaround for circular dependency in Symfony2 services
<?php
namespace Acme\SiteBundle\Listener;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Acme\SiteBundle\Entity\Comment;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
@lavoiesl
lavoiesl / assets_version.php
Created October 24, 2012 18:02
Automatic cache busting using Git commit in Symfony2
<?php
// app/config/assets_version.php
$container->loadFromExtension('framework', array(
'templating' => array(
'engines' => array('twig'),
'assets_version' => exec('git rev-parse --short HEAD'),
),
));
@webmozart
webmozart / git-find-merge
Created November 15, 2012 14:32
Script to find the merge and PR a commit occurred in
#!/bin/bash
COMMIT=$1
BRANCH=$2
if [ -z $BRANCH ]; then
BRANCH="master"
fi
perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' \
<(git rev-list --ancestry-path --oneline $COMMIT..$BRANCH) \
@jbenet
jbenet / simple-git-branching-model.md
Last active June 14, 2024 17:16
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@soarez
soarez / ca.md
Last active May 28, 2024 02:57
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.