Skip to content

Instantly share code, notes, and snippets.

View apoca's full-sized avatar
🚀
Working hard with microservices infrastructure

Miguel Vieira apoca

🚀
Working hard with microservices infrastructure
View GitHub Profile
My controller Login:
public function authenticateAction()
{
$request = $this->getRequest();
if ($request->isPost()){
$params = $request->getPost()->toArray();
//check authentication...
$username = $request->getPost('npo-login-email');
ERROR:
Fatal error: Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'ZfcRbac\Role\RoleProviderPluginManager::get was unable to fetch or create an instance for ' in /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:529 Stack trace: #0 /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(103): Zend\ServiceManager\ServiceManager->get(NULL, true) #1 /Applications/MAMP/htdocs/RadiusCheck/vendor/zf-commons/zfc-rbac/src/ZfcRbac/Factory/RoleServiceFactory.php(51): Zend\ServiceManager\AbstractPluginManager->get(NULL, false) #2 [internal function]: ZfcRbac\Factory\RoleServiceFactory->createService(Object(Zend\ServiceManager\ServiceManager), 'zfcrbacservicer...', 'ZfcRbac\Service...') #3 /Applications/MAMP/htdocs/RadiusCheck/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php(902): call_user_func(Array, Obj
var http = require('http');
var https = require('https');
var fs = require('fs');
var socket = require('socket.io');
var express = require('express');
var app = express();
var port = 3000;
var server = https.createServer(sslOptions, app).listen(port, function(){
'asset_manager' => array(
'caching' => array(
'default' => array(
'cache' => 'Assetic\\Cache\\FilesystemCache',
'options' => array(
'dir' => 'public/cache'
)
)
),
'resolver_configs' => array(
<?xml version="1.0" encoding="UTF-8" ?>
<project name="PHP_CodeCoverage">
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor" />
<delete file="${basedir}/composer.lock" />
</target>
<target name="composer" depends="clean" description="Install dependencies with Composer">
<tstamp>
<format property="thirty.days.ago" pattern="MM/dd/yyyy hh:mm aa" offset="-30" unit="day" />
$http = new Client([
'base_uri' => 'http://esolidar-api',
]);
// print_r($http);
$request = $http->post('/users/auth', [
'json' => [
'username' => 'vieira@miguelvieira.com.pt',
'password' => 'Jk6gci3PyjhHk1'
]
]);
@apoca
apoca / gist:a9666ba74ef4625fcce7
Created June 8, 2015 12:15
client http apigility
$client = new Client([
'base_uri' => 'http://esolidar-api',
'headers' => ['Accept' => 'application/json'],
]);
$headers = ['Content-type' => 'application/json; charset=UTF-8', 'Accept' => 'application/json'];
$body = json_encode(array('username' => $params['username'], 'password' => $params['password']));
$request = new Request('POST', 'http://esolidar-api/users/auth', $headers, $body);
$statement = "SELECT id, name FROM users WHERE status = 'P'";
/**
* Query string
*/
public function queryString($statement)
{
$adapter = $this->adapter;
$results = $adapter->query($statement, $adapter::QUERY_MODE_EXECUTE);
return $results;
@apoca
apoca / php
Created October 9, 2015 10:13
bootstrap
public function onBootstrap(MvcEvent $e)
{
$request = $e->getRequest();
$eventManager = $e->getApplication()->getEventManager();
$serviceManager = $e->getApplication()->getServiceManager();
$sharedManager = $e->getApplication()
->getEventManager()
->getSharedManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
@apoca
apoca / gist:39a2fdc9658f4cbc5af1
Last active October 15, 2015 17:01
.htaccess block bots...
RewriteEngine On
# new lines to block bad bots
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]