Skip to content

Instantly share code, notes, and snippets.

View spudro228's full-sized avatar
👌
Bussy

Dmitry Smolyakov spudro228

👌
Bussy
  • Russia
View GitHub Profile
@Batou99
Batou99 / apue.h
Created April 11, 2011 14:00
apue.h
/* Our own header, to be included before all standard system headers */
#ifndef _APUE_H
#define _APUE_H
#if defined(SOLARIS)
#define _XOPEN_SOURCE 500 /* Single UNIX Specification, Version 2 for Solaris 9 */
#define CMSG_LEN(x) _CMSG_DATA_ALIGN(sizeof(struct cmsghdr)+(x))
#elif !defined(BSD)
#define _XOPEN_SOURCE 600 /* Single UNIX Specification, Version 3 */
@sallar
sallar / console-example.php
Created March 27, 2013 19:44
PHP Colored CLI Output Script.
<?php
// Output screenshot:
// http://cl.ly/NsqF
// -------------------------------------------------------
include_once 'console.php';
// ::log method usage
// -------------------------------------------------------
Console::log('Im Red!', 'red');
@nick-mok
nick-mok / AnObj.php
Last active January 2, 2020 19:06
This is a revision of George Mihailhoff's PHP Anonymous Object Class. I stumbled upon this class as I was looking for a way to attach functions to properties in a stdClass. This is not directly possible as there is no __call function inbuilt. And I found this code on a stackoverflow post that George had answered. However the implementation didn'…
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{
@bastman
bastman / build.properties
Created October 8, 2013 16:29
phing example tasks
project.environment.name=local
project.name=${phing.project.name}
dir.build_xml=${project.basedir}
project.host.default=${project.environment.name}.${project.name}.mydomain.com
dir.project=${dir.build_xml}/../../..
@MontealegreLuis
MontealegreLuis / DoctrineTable.php
Last active August 5, 2021 12:44
Pagination and DDD
<?php
namespace Doctrine1\TableGateway;
use \Doctrine_Record as Record;
use \Doctrine_Query as Query;
use \Doctrine1\QuerySpecifications\Specification;
abstract class DoctrineTable
{
protected $record;
@staltz
staltz / introrx.md
Last active May 29, 2024 05:51
The introduction to Reactive Programming you've been missing
@preshing
preshing / build_cross_gcc
Last active May 21, 2024 13:44
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.

What's the difference between cascade="remove" and orphanRemoval=true in Doctrine 2

TLDR: The cascade={"remove"} is like a "software" onDelete="CASCADE", and will remove objects from the database only when an explicit call to $em->remove() occurs. Thus, it could result in more than one object being deleted. orphanRemoval can remove objects from the database even if there was no explicit call to ->remove().

I answered this question a few times to different people so I will try to sum things up in this Gist.

Let's take two entities A and B as an example. I will use a OneToOne relationship in this example but it works exactly the same with OneToMany relationships.

class A
@region23
region23 / golang_books_sites.md
Last active July 18, 2022 08:58
Полезные ресурсы для изучающих Go

На русском языке

Русскоязычные сайты и сообщества

English resources

@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active May 27, 2024 22:57
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on