Skip to content

Instantly share code, notes, and snippets.

View Koc's full-sized avatar
🇺🇦
Donate to United24 or Come Back Alive

Konstantin Myakshin Koc

🇺🇦
Donate to United24 or Come Back Alive
  • METRO Markets GmbH
  • Ukraine, Kyiv
  • X @myakshin
View GitHub Profile
@beberlei
beberlei / Util.php
Created June 23, 2011 09:25
Controllers as Services revisited
<?php
namespace Whitewashing\BlogBundle\Controller;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
*
*/
@antonkril
antonkril / gist:1057298
Created June 30, 2011 21:35
DDD Filtering Enhancements
We couldn’t find that file to show.
@sasha-id
sasha-id / README
Created March 23, 2012 15:03
MongoDB multiple instance upstart scripts: mongodb, mongod --configsvr and mongos
MongoDB upstart scripts for Ubuntu.
Run following commands after installing upstart scripts:
ln -s /lib/init/upstart-job /etc/init.d/mongoconf
ln -s /lib/init/upstart-job /etc/init.d/mongodb
ln -s /lib/init/upstart-job /etc/init.d/mongos
To start services use:
@leon
leon / nginx.conf
Created June 29, 2012 16:34
Nginx PHP-FPM Symfony 2 minimal config
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@diemuzi
diemuzi / README
Created October 7, 2012 19:44
Apache 2.2.x / 2.4.x FPM Configuration
This configuration is a working copy which I have tested on Apache 2.2.x and 2.4.x
I highly recommend you use this version of mod_fastcgi as it works with Apache 2.4.x, fastcgi.com version does not!
https://github.com/ByteInternet/libapache-mod-fastcgi
The fastcgi.com version is 2.4.6, the version I am recommending registers as 2.4.7
To patch mod_fastcgi for use with Apache 2.4.x look at the debian/patches folder. It's not specific to Debian OS so don't let that fool you. I personally use Archlinux.
Of course to compile mod_fastcgi:
@prime31
prime31 / gist:5675017
Last active May 28, 2024 11:37
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@cristianoc72
cristianoc72 / violations_to_array.php
Last active January 14, 2022 22:07
Extract, from a ConstraintViolationsList object, an associative array where the keys are property names and values are error messages. This function was originally created to be used inside a Propel2 project. Anyway, it can be used in every project following the PSR-0 and using the Symfony Validator Component.
<?php
/**
* This function was originally created to be used inside a Propel2 project.
* Anyway, it can be used in every project following the PSR-0 and using the Symfony Validator Component.
*
* @see http://symfony.com/doc/current/book/validation.html
* @see https://github.com/propelorm/Propel2/blob/master/documentation/behaviors/validate.markdown
*/
use Symfony\Component\Validator\ConstraintViolationList;
@romaricdrigon
romaricdrigon / formController.js
Created August 21, 2013 07:46
Using AngularJS on Symfony2 forms
// An example controller binded to the form
function FormCntl($scope, $compile) {
// Consider using FosJsRouting bundle, if you want to use a Symfony2 route
$scope.formUrl = "http://url-to-fetch-my-form";
// Data from the form will be binded here
$scope.data = {};
// Method called when submitting the form
$scope.submit = function() {
@IvanChepurnyi
IvanChepurnyi / Table.php
Last active July 11, 2022 10:44
Optimized options load
<?php
/**
* Optimized version of attribute source options model
*
* That allows to preload options once and reuse them instead of doing calls to db all the time
*
*/
class EcomDev_Optimization_Model_Resource_Attribute_Source_Table
extends Mage_Eav_Model_Entity_Attribute_Source_Table
@zhuzhuor
zhuzhuor / run_script.bat
Created November 1, 2013 20:05
Batch file to run a Python script in the same folder
@ECHO off
set "script_path=%~dp0"
set "script_path=%script_path%my_script.py"
python %script_path% %*