Skip to content

Instantly share code, notes, and snippets.

View eniuz's full-sized avatar

Mariusz Szot eniuz

View GitHub Profile
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@eniuz
eniuz / myapp.js
Created December 6, 2013 11:41 — forked from refractalize/myapp.js
// your app
myapp = angular.module('myapp', []);
myapp.directive('userView', function () {...});
myapp.factory('userApi', function () {...});

Simplified behat for Tim Hunt.

Disclaimers:

  • I'm hoping this will help you understand so you can help us improve our documentation.
  • This is simplified version, i'm ignoring some details which are unimportant for discusing this.

What Behat requires.

<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
abstract class FakeHttpTestCase extends \PHPUnit_Framework_TestCase
{
const APP_URL = 'http://127.0.0.1:8000';
/**
@eniuz
eniuz / README.md
Last active August 29, 2015 14:27 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).

The related Nginx options are:

@eniuz
eniuz / gist:7e2b3c3f640ca91c48d2
Last active August 29, 2015 14:28 — forked from stuart11n/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@eniuz
eniuz / gitflow-breakdown.md
Last active August 29, 2015 14:28 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@eniuz
eniuz / tmux-cheatsheet.markdown
Last active September 4, 2015 08:24 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@eniuz
eniuz / gist:7fca76a12c6f5b97601e
Created September 25, 2015 09:54 — forked from haruair/gist:b8ff4fb128488f5e1dbf
How to get all category tree node in Magento
<?php
// Usually, you can get category tree from category helper
$helper = Mage::helper('catalog/category');
$nodes = $helper->getStoreCategories();
// return Varien_Data_Tree_Node_Collection
// via Mage_Catalog_Model_Resource_Category
// However, this get method return active category only.
// Most of the samples are for collection of the category.