Skip to content

Instantly share code, notes, and snippets.

View josecelano's full-sized avatar

Jose Celano josecelano

View GitHub Profile
@josecelano
josecelano / validation-in-ddd.php
Created March 31, 2015 14:45
Validation in DDD
<?php
class PaymentController
{
public function makePayment()
{
// POST data:
// fromCustomerId
// toCustomerId
// amount
Verifying that +josecelano is my openname (Bitcoin username). https://onename.com/josecelano
@josecelano
josecelano / second.php
Last active August 29, 2015 14:20
Adding SDK Configurations to enable Logging
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
//require __DIR__ . '/php-client/autoload.php'; // Direct Donwload
require __DIR__ . '/vendor/autoload.php'; // Using Composer
// 2. Provide your Token. Replace the given one with your token
// https://accounts.blockcypher.com/dashboard
$token = 'c0afcccdde5081d6429de37d16166ead';
$apiContext = new \BlockCypher\Rest\ApiContext(
@josecelano
josecelano / third.php
Last active August 29, 2015 14:20
Adding File based SDK Configurations
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
//require __DIR__ . '/php-client/autoload.php'; // Direct Donwload
require __DIR__ . '/vendor/autoload.php'; // Using Composer
// 2. Define BC_CONFIG_PATH directory
if(!defined("BC_CONFIG_PATH")) {
define("BC_CONFIG_PATH", __DIR__);
}
@josecelano
josecelano / sdk_config.ini
Last active August 29, 2015 14:20
SDK Configurations
;## This is an example configuration file for the SDK.
;## The sample scripts configure the SDK dynamically
;## but you can choose to go for file based configuration
;## in simpler apps (See bootstrap.php for more).
[Account]
acct1.AccessToken = c0afcccdde5081d6429de37d16166ead
;Connection Information
[Http]
; Add Curl Constants to be configured
@josecelano
josecelano / first.php
Last active October 20, 2019 17:45
Make First Call PHP File
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
require __DIR__ . '/php-client/autoload.php';
// 2. Provide your Token. Replace the given one with your app Token
// https://accounts.blockcypher.com/dashboard
$token = 'c0afcccdde5081d6429de37d16166ead';
$apiContext = new \BlockCypher\Rest\ApiContext(
new \BlockCypher\Auth\SimpleTokenCredential($token)
@josecelano
josecelano / setup_selenium.sh
Last active November 9, 2015 16:51 — forked from curtismcmullan/setup_selenium.sh
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
sudo apt-get update
<?php
final class GetProjectsController extends Controller
{
/**
* @var QueryObjectFactory
*/
private $queryObjectFactory;
/**
@josecelano
josecelano / pre-commit
Created February 17, 2016 12:31 — forked from raphaelstolt/pre-commit
A pre-commit for running PHPUnit
#!/usr/bin/php
<?php
printf("%sGit pre-commit hook %1\$s", PHP_EOL);
$projectName = basename(getcwd());
exec('phpunit --configuration phpunit.xml', $output, $returnCode); // Assuming cwd here
if ($returnCode !== 0) {
$minimalTestSummary = array_pop($output);
printf("Test suite for %s failed: ", $projectName);
printf("( %s ) %s%2\$s", $minimalTestSummary, PHP_EOL);
return false; // exit(1);
#!/bin/sh -v
# Set directories permissions
# Set Apache user as group owner for directories which require write perms
# This script is running as jenkins user. Jenkins should belong to www-data group
find ./vendor/orchestra/testbench/fixture/storage -type d -exec chgrp -v www-data {} +
find ./vendor/orchestra/testbench/fixture/storage -type d -exec chmod ug+rw {} +
find ./vendor/orchestra/testbench/fixture/bootstrap/cache -type d -exec chgrp -v www-data {} +
find ./vendor/orchestra/testbench/fixture/bootstrap/cache -type d -exec chmod ug+rw {} +
chgrp -v www-data ./vendor/orchestra/testbench/fixture/bootstrap/cache/services.php
chmod ug+rw ./vendor/orchestra/testbench/fixture/bootstrap/cache/services.php