Skip to content

Instantly share code, notes, and snippets.

View ppeiris's full-sized avatar
🏋️‍♂️
Working on machine learning projects

Prabath Peiris ppeiris

🏋️‍♂️
Working on machine learning projects
View GitHub Profile
#0 /var/ftridp/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(640): Zend\ServiceManager\AbstractPluginManager->createFromInvokable('logincontroller...', 'Login\\Controlle...')
#1 /var/ftridp/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(597): Zend\ServiceManager\ServiceManager->doCreate('Login\\Controlle...', 'logincontroller...')
#2 /var/ftridp/vendor/zendframework/zend-servicemanager/src/ServiceManager.php(530): Zend\ServiceManager\ServiceManager->create(Array)
#3 /var/ftridp/vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php(161): Zend\ServiceManager\ServiceManager->get('Login\\Controlle...', true)
#4 /var/ftridp/vendor/zendframework/zend-mvc/src/DispatchListener.php(94): Zend\ServiceManager\AbstractPluginManager->get('Login\\Controlle...')
#5 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#6 /var/ftridp/vendor/zendframework/zend-eventmanager/src/EventManager.php(490): call_user_func(Array, Object(Zend\Mvc\MvcEven
@ppeiris
ppeiris / useful_pandas_snippets.py
Created February 9, 2016 19:53 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@Oapp.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class Entities.User extends Entities.Model
urlRoot: 'https://xxxxxxxxxxxx.com/api/users'
class Entities.UserCollection extends Entities.Collection
model: Entities.User
url: 'https://xxxxxxxxxxxxxxx.com/api/users'
parse: (respose, options) ->
return respose._embedded.Users
$this->serviceManager->getServiceLocator()->get('config');
$client = new \Zend\Http\Client(
'https://oapp-json04.globalinxdev.com/api/mainmenu/full', array(
'maxredirects' => 0,
'timeout' => 30,
'sslcapath' => '/etc/pki/tls/certs/',
'Accept' => 'application/json',
'Content-Type' => 'application/json'
));
<?php
public function getConfig()
{
$userValidation = require __DIR__ . '/config/validation.config.php';
$userConfig = \Zend\Stdlib\ArrayUtils::merge($userValidation, require __DIR__ . '/config/module.config.php');
return $userConfig;
//return include __DIR__ . '/config/module.config.php';
<?php
return array(
'router' => array(
'routes' => array(
'users-api.rest.users' => array(
'type' => 'Segment',
'options' => array(
'route' => '/api/users[/:id]',
'defaults' => array(
'controller' => 'UsersApi\\V1\\Rest\\Users\\Controller',
<?php
/**** config.php *****/
'hydrators' => array(
'invokables' => array(
'UserEntityHydrater' => 'UsersApi\\V1\\Rest\\Hydrators\\UserEntityHydrate',
),
),
var RootRouter = Backbone.Router.extend({
routes: {
"acllist": "showAclRules",
"aclresources": "showAclResources",
},
initialize: function () {
//console.log('initialize');
//this.AclListModel = new AclListModel();
<?php
namespace AccountServiceTest;
use Zend\Loader\AutoloaderFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\ServiceManager;
use RuntimeException;
error_reporting(E_ALL | E_STRICT);
<?php
namespace AccountServiceTest\Service;
use PHPUnit_Framework_TestCase;
use AccountService\Service\Accounts as Accounts;
class AccountsServiceTest extends PHPUnit_Framework_TestCase {
public $sm;
public $login;
public $entityManager;