Skip to content

Instantly share code, notes, and snippets.

View jaymecd's full-sized avatar

Nikolai Zujev jaymecd

View GitHub Profile
@masak
masak / five-rules.txt
Created March 9, 2012 20:26
Five CQRS rules
1. Your application consists of three parts. Information always flows
"clockwise": clients, write side, read sides. Clients send Commands
to write side. Write side publishes Events to read sides. Read sides
reply to Queries for client.
2. The interesting logic is all in the write side, but your design may
consist *only* of the totality of Commands, Events, and Queries.
3. Each Command or Event has exactly one aggregate that it's acting on,
identified by unique aggregate ID. There need not be a one-to-one
@jmikola
jmikola / Document.php
Created May 18, 2012 15:51
Doctrine MongoDB ODM flush benchmark
<?php
use Doctrine\ODM\MongoDB\Mapping\Annotations as Mongo;
/** @Mongo\Document(collection="documents") */
class Document
{
/** @Mongo\Id */
public $id;
@jpoehls
jpoehls / mklink.psm1
Created June 7, 2012 19:40
Native PowerShell wrapper for MKLINK.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 27, 2024 09:43
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jmikola
jmikola / FindInvalidReferencesCommand.php
Created July 27, 2012 21:47
Find invalid references among Doctrine MongoDB ODM documents
<?php
namespace Acme\FooBundle\Command;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class FindInvalidReferencesCommand extends ContainerAwareCommand
@pierremarc
pierremarc / test_cc.py
Created September 19, 2012 15:21
Add files to a repo with pygit2
"""
test commit creation with pygit2
To see the result:
rm -rf foo && python test_cc.py && cd foo/ && git log --graph --oneline --date-order --decorate --color --all && git status && cd ..
"""
import os
import sys
import pygit2
@sgergely
sgergely / gist:3793166
Created September 27, 2012 09:43
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@throughnothing
throughnothing / pr.md
Created October 29, 2012 16:51 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Sitebase
Sitebase / Doctrine.php
Created February 22, 2013 13:48
Custom doctrine type to store uuid's as binary(16) values in a MySQL database. Set the column type that you want to use as BINARY(16) in MySQL and your good to go.
\Doctrine\DBAL\Types\Type::addType('uuid', 'BuboBox\Doctrine2\DBAL\Types\UuidType');
@dbu
dbu / ImageType.php
Created March 12, 2013 11:03
i needed a form type that determines based on the bound data if it should be required or not (to make file upload required if we create a new entity, but optional when editing the entity with the file. as this happens in a embedded sonata, i have no way of knowing the actual data when creating the form in the form builder. this is what i came up…
<?php
class ImageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['required_auto'] && ! $options['required']) {
$builder->addEventListener(\Symfony\Component\Form\FormEvents::PRE_SET_DATA, array($this, 'determineRequired'));
}