Skip to content

Instantly share code, notes, and snippets.

View DenisGorbachev's full-sized avatar

Denis Gorbachev DenisGorbachev

View GitHub Profile
@DenisGorbachev
DenisGorbachev / GroupedDocumentChoiceList
Created June 9, 2012 10:57
GroupedDocumentChoiceList
<?php
namespace FasterThanWind\Bundle\TaskBundle\Form\ChoiceList;
use Symfony\Bundle\DoctrineMongoDBBundle\Form\ChoiceList\DocumentChoiceList as DocumentChoiceList;
use Symfony\Component\Form\Util\PropertyPath;
use Doctrine\ODM\MongoDB\DocumentManager;
/**
* Allows to choose from a list of documents, optionally grouped by a certain property (triggers the use of <optgroup> in template)
starfall@nx:~$ ping beingremarkable.me
PING beingremarkable.me (65.39.205.61) 56(84) bytes of data.
^C
--- beingremarkable.me ping statistics ---
32 packets transmitted, 0 received, 100% packet loss, time 31231ms
<application>
<component name="XDebuggerSettings">
<data-views />
<general />
<debuggers>
<debugger id="elixir">
<configuration>
<module-filters>
<list>
<module-filter pattern="Access" />
@DenisGorbachev
DenisGorbachev / .mongorc.js
Last active August 22, 2019 12:55
~/.mongorc.js
RegExp.escape = function(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};
DBCollection.prototype.findOld = DBCollection.prototype.find;
DBCollection.prototype.find = function(query, fields) {
if (typeof query === 'string') {
var re = new RegExp(RegExp.escape(query), "i");
query = {$or: [{_id: re}, {name: re}, {title: re}, {text: re}, {"emails.address": re}]};
}