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
<?php
namespace Apps\Geography\Models;
use Apps\Users\Libraries\IModelUserField;
use Core\Libraries\Model\Model;
use Core\Libraries\Behaviors\Timestampable;
use Core\Libraries\Model\IStatus;
use Core\Libraries\Behaviors\Status;
use Apps\Users\Models\UserFields;
@apoca
apoca / ServiceProvider.php
Created March 14, 2023 15:26
Phalcon v5 Service Provider
<?php
namespace Core\Provider\KernelCacheAdapter;
use Core\Provider\AbstractServiceProvider;
use Phalcon\Cache\Adapter\Filesystem;
use Phalcon\Storage\SerializerFactory;
use Phalcon\Storage\Serializer\Php;
/**
@apoca
apoca / js
Created April 28, 2020 19:04
lambda function resize image and return base 64
/**
* Module dependencies.
*/
import { S3 as _S3 } from 'aws-sdk';
import { generateS3Key } from './lib/utils';
import { isNullOrUndefined } from 'util';
import sharp from 'sharp';
const S3 = new _S3({
@apoca
apoca / verify_crowdfunding_paypal_payment_success.php
Last active February 24, 2019 17:00
Laravel feature test mocking with mockery
public function verify_crowdfunding_paypal_payment_success()
{
$user = Passport::actingAs(
factory(User::class)->create()
);
$institution = factory(Institution::class)->create();
$crowdfunding = factory(Crowdfunding::class)->create([
'institution_id' => $institution->id,
]);
-------------------------------------
/var/log/awslogs.log
-------------------------------------
2018-11-17 00:02:46,407 - cwlogs.push.publisher - INFO - 3029 - Thread-9 - Log group: /aws/elasticbeanstalk/Onyx-demo/var/log/nginx/error.log, log stream: i-05979c125891aae9b, queue size: 0, Publish batch: {'skipped_events_count': 0, 'first_event': {'timestamp': 1542412960787, 'start_position': 4329L, 'end_position': 4570L}, 'fallback_events_count': 0, 'last_event': {'timestamp': 1542412960787, 'start_position': 4570L, 'end_position': 4810L}, 'source_id': 'a19486b25665b6abba0eee6683bbb9a6', 'num_of_events': 2, 'batch_size_in_bytes': 531}
2018-11-17 00:02:51,015 - cwlogs.push.publisher - INFO - 3029 - Thread-5 - Log group: /aws/elasticbeanstalk/Onyx-demo/var/log/web-1.log, log stream: i-05979c125891aae9b, queue size: 0, Publish batch: {'skipped_events_count': 0, 'first_event': {'timestamp': 1542412964954, 'start_position': 309055L, 'end_position': 309348L}, 'fallback_events_count': 0, 'last_event': {'timestamp': 15

Keybase proof

I hereby claim:

  • I am apoca on github.
  • I am apocalipse (https://keybase.io/apocalipse) on keybase.
  • I have a public key ASC0pXVuU3zVgW_NhoEV8UOGVke0VoVK9o6nQHoY3hvd5wo

To claim this, I am signing this object:

@apoca
apoca / gist:b39ec310ab1a371c4edbc561a1236e56
Created July 20, 2017 13:06
FormQuestionsGenerator.js
import _ from 'lodash';
import React from 'react';
import langPT from '../../../translations/pt';
import langEn from '../../../translations/en';
import {injectIntl} from 'react-intl';
import TextareaField from '../../common/fields/textareaField';
import TextField from "../../common/fields/textField";
FormQuestionsGenerator.propTypes = {
questions: React.PropTypes.array.isRequired,
<?php
namespace App\Action\Factory;
use App\Action\UserApiAction;
use Interop\Container\ContainerInterface;
use Zend\Expressive\Router\RouterInterface;
use Zend\Expressive\Template\TemplateRendererInterface;
use Application\Model\UsersTable;
<?php
// Delegate static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server'
&& is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))
) {
return false;
}
chdir(dirname(__DIR__));
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}