Skip to content

Instantly share code, notes, and snippets.

View aurimasniekis's full-sized avatar

Aurimas Niekis aurimasniekis

View GitHub Profile
The main design:
* Many ways to communicate between process such as Sockets, Streams, Fifo, 0MQ, RabbitMQ (I choose driver approach)
* A posix signal handler class to wich you can assign handler for signals and other stuff like send signal to process
* A packet handler which will handle packets sent between processes and trigger handlers to respond to signals. For e.q. ReloadConfig handle will trigger process to reload config
* A connection class wich will have a driver assigned to it and all pids and other stuff witch related to IPC
<?php
class Obj {
public $mod = false;
}
class Example {
protected $items = array();
public function getItems()
<?php
class User {
public function getRoles()
{
if ($this->roles) {
return $this->roles;
}
/** @var UserGroup[] $userGroups */
$(document).ready(function() {
var toggleVisible = function(div, label) {
if (div.is(':visible')) {
$.removeCookie('hiddenFilter');
div.hide();
} else {
$.cookie('hiddenFilter', 1);
div.show();
}
const char* packetType = jsonObject["type"];
if (packetType == "ping") {
// never reaches
}
<?php
class CachedContainer extends Container
{
protected $container;
public function __construct()
{
$this->container['foo'] = new Bar();
$this->container['bar'] = new Foo();
module.provider('contentElement', ['$provide', '$injector', '$rootScope', function($provide, $injector, $rootScope) {
module.provider('contentElement', ['$provide', '$injector', function($provide, $injector, $rootScope) {
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
<?php
public function commentNewAction(Request $request, Post $post)
{
$form = $this->createCommentForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var Comment $comment */
$comment = $form->getData();
<?php
use EPWT\DataMapper\DataMap;
use Symfony\Component\Validator\Constraints as Assert;
class dataMapBooksFullBookInfo extend DataMap
{
/**
* @var stirng
*/