Skip to content

Instantly share code, notes, and snippets.

View dbaltas's full-sized avatar

Dimitris Baltas dbaltas

View GitHub Profile
@dbaltas
dbaltas / zend-soap-https-timeout-through-curl
Created May 10, 2012 15:53
Set Timeout on SOAP requests for https connections using curl on Zend Framework
function simulateSoapRequest($request, $location, $action, $version)
{
$client = new Zend_Http_Client($location);
$adapter = new Zend_Http_Client_Adapter_Curl();
$client->setAdapter($adapter);
$adapter->setCurlOption(CURLOPT_TIMEOUT, $this->_timeout);
$client->setMethod(Zend_Http_Client::POST);
$client->setHeaders('Content-Type', $version == 2 ? 'application/soap+xml' : 'text/xml');
$client->setHeaders('SOAPAction', $action);
@dbaltas
dbaltas / gitignore-centurion-in-existing-zf-app
Created September 20, 2012 07:39
.gitignore updates for Centurion integration in existing Zend Framework Application
+/public/files/*
+/public/cached/*
+!/public/files/.gitkeep
+!/public/cached/.gitkeep
+
+/data/cache/class/*
+/data/cache/core/*
+/data/cache/output/*
+/data/cache/page/*
+/data/cache/tags/*
@dbaltas
dbaltas / init.php-updates-for-centurion
Created September 20, 2012 08:08
init.php updates for Centurion integration in existing Zend Framework Application
+require_once 'Centurion/Application.php';
+
+require_once 'Zend/Loader/Autoloader.php';
+$autoloader = Zend_Loader_Autoloader::getInstance()
+ ->registerNamespace('Centurion_')
+ ->setDefaultAutoloader(create_function('$class',
+ "include str_replace('_', '/', \$class) . '.php';"
+ ));
@dbaltas
dbaltas / bootstrap-updates-centurion-in-existing-zf-app
Created September 20, 2012 08:57
Bootstrap updates for Centurion integration in existing Zend Framework Application
+ $opts = Zend_Registry::get('config')->centurion->toArray();
+ Centurion_Config_Manager::set('centurion.auth_profile', $opts['auth_profile']);
+ $translation = Zend_Registry::get('config')->translation->toArray();
+ Centurion_Config_Manager::set('translation', $translation);
+ Centurion_Config_Manager::set('resources', Zend_Registry::get('config')->resources);
}
protected function _initView()
{
+ Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->setView(new Centurion_View);
@dbaltas
dbaltas / application-ini-centurion-in-existing-zf-application
Created September 20, 2012 09:00
application.ini updates for Centurion integration in existing Zend Framework Application
+autoloadernamespaces.3 = "Centurion_"
+resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
+resources.frontController.params.displayExceptions = 0
+phpSettings.display_startup_errors = 0
+phpSettings.display_errors = 0
+
+zfdebug = false
+
+centurion.auth_profile = "User_Model_DbTable_Profile"
@dbaltas
dbaltas / composer-install
Created January 31, 2013 17:22
Script to install composer
cd /usr/local/bin/ &&
curl -s https://getcomposer.org/installer | sudo php &&
sudo chmod a+x composer.phar &&
sudo mv composer.phar composer
@dbaltas
dbaltas / review-handon-testing-with-phpunit-howto.md
Last active December 18, 2015 11:28
Review on Hands­on Testing with PHPUnit How­to

PHPUnit is a testing framework that is supported, integrated and suggested by the majority of PHP frameworks.Test Driven Development (TDD), and Continuous Integration are here to stay and PHPUnit is an industry standard that caters for both.

The book [‘Hands­on Testing with PHPUnit How­to’][1] offers a quick but thorough step by step guide over the core concepts of PHPUnit. In a ‘learn by example’ approach the programmer gets acquainted with the TDD process without feeling overwhelmed with pompous definitions.

@dbaltas
dbaltas / random-thoughts-on-paratest-architecture.md
Created June 30, 2013 23:53
Identify the Major Components of brianium/paratest

The objective of ParaTest is to support parallel testing in a variety of PHP testing tools.

We can split paratest tasks

  1. Identify the ExecutableTests to be run
  2. Run
  3. Collect output, parse and summarize

The List of Executable Tests

Identify the test suites that need to be executed

@dbaltas
dbaltas / entries-dummy.json
Created December 19, 2015 17:18
js/app/data/entries.json for greek-in-tech
This file has been truncated, but you can view the full file.
[
{
"id" : 1,
"title": "Cron (job scheduler)",
"description": "It comes from the Greek word for time, chronos (χρόνος). Chronos is the personification of time in early Greek mythology and literature. He later appears in the Renaissance as Father Time.",
"viewed" : false,
"categories": [
"OS",
"unix",
"linux",
@dbaltas
dbaltas / tidy_xml_lint.py
Created July 22, 2013 14:15
Sublime Text 3 plugin for formatting xml. Works on Sublime Text 2 as well. Created by André Bergonse http://www.bergspot.com/blog/2012/05/formatting-xml-in-sublime-text-2-xmllint/
import sublime, sublime_plugin, subprocess
class TidyXmlLintCommand(sublime_plugin.TextCommand):
def run(self, edit):
command = "XMLLINT_INDENT='\t' xmllint --format --encode utf-8 -"
# help from http://www.sublimetext.com/forum/viewtopic.php?f=2&p=12451
xmlRegion = sublime.Region(0, self.view.size())
p = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
result, err = p.communicate(self.view.substr(self.view.sel()[0]).encode('utf-8'))