Skip to content

Instantly share code, notes, and snippets.

View eniuz's full-sized avatar

Mariusz Szot eniuz

View GitHub Profile
@eniuz
eniuz / faster-autoload.php
Created April 28, 2015 09:36
Faster Autoload
<?php
/**
* This code has being taken from Patrick Allert's article:
*/
spl_autoload_register(
function ( $className )
{
if (
strpos( $className, "Symfony\\" ) === 0 ||
public function get_course_sections()
{
global $DB;
$table = 'course_sections';
$condition ='section IS NOT NULL AND sequence != ""';
$params = ['course' => $this->course->id];
$asections = $DB->get_records_select($table, $condition, $params);
$modinfo = get_fast_modinfo($this->course, $this->user);
<?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 / symfony-installer.sh
Last active August 29, 2015 14:21
symfony-installer
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod +x /usr/local/bin/symfony
symfony new my_new_project
@eniuz
eniuz / recursive-page-download.sh
Created May 26, 2015 16:10
Recursive Page Download
wget http://example.com \
--domains example.com \
--recursive \
--page-requisites \
--no-clobber \
--html-extension \
--convert-links
@eniuz
eniuz / log-gulp-events.js
Created May 28, 2015 19:11
log gulp events
gulp.task('watch-lint', function(){
gulp.watch('./src/**/*.less', function(event){
console.log('watched event %s for event type %s', event.type, event.path);
});
});
@eniuz
eniuz / enable-admin-panel-blocks.sql
Last active August 29, 2015 14:24
enable-blocks-in-admin-panel
# default may be changed to websites or stores as well
INSERT INTO core_config_data (scope, scope_id, path, value) VALUES ('default', 0, 'dev/debug/template_hints', 1), ('default', 0, 'dev/debug/template_hints_blocks', 1);
UPDATE core_config_data SET value=0 WHERE path='dev/debug/template_hints';
UPDATE core_config_data SET value=0 WHERE path='dev/debug/template_hints_blocks';
@eniuz
eniuz / update-magento-admin.sql
Created July 17, 2015 08:08
Update magento admin
UPDATE admin_user SET password = MD5('NEWPASSWORD') WHERE username = 'admin';
@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: