Skip to content

Instantly share code, notes, and snippets.

@jasperkuperus
jasperkuperus / DiscriminatorListener.php
Last active July 7, 2023 17:35
This gist shows you how to define your discriminator maps at child level in doctrine 2. Why? Because your parent class shouldn't be aware of all it's subclasses. Please read my article for more explanation: https://medium.com/@jasperkuperus/defining-discriminator-maps-at-child-level-in-doctrine-2-1cd2ded95ffb
<?php
namespace My\Namespace;
/**
* This Listener listens to the loadClassMetadata event. Upon this event
* it hooks into Doctrine to update discriminator maps. Adding entries
* to the discriminator map at parent level is just not nice. We turn this
* around with this mechanism. In the subclass you will be able to give an
* entry for the discriminator map. In this listener we will retrieve the
* load metadata event to update the parent with a good discriminator map,
@justsee
justsee / sv-unicorn-run.erb
Last active December 14, 2015 04:09 — forked from brentkirby/service
Chef + runit + Unicorn + rbenv
#!/bin/bash -e
export RBENV_ROOT=/usr/local/rbenv
export PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:"$PATH"
APP="<%= @options[:app].application.name %>"
APP_PATH="<%= @options[:app].path %>"
RAILS_ENV="<%= @options[:rails_env] %>"
UNICORN_CONFIG="/etc/unicorn/${APP}.rb"
CUR_PID_FILE="${APP_PATH}/shared/pids/unicorn.pid"
@astanin
astanin / .XCompose
Created October 29, 2010 09:29
My Compose key configuration
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
# Punctuation
# знаки препинания, необходимые в русском, которых нет в en_US.UTF-8/Compose
<Multi_key> <period> <minus> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <period> <space> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <?> <!> : "⁈" U2048 # QUESTION EXCLAMATION, ?!
<Multi_key> <period> <colon> : "…" # ELLIPSIS
# №: набирается в русской раскладке без ухищрений,