Skip to content

Instantly share code, notes, and snippets.

View humbertodosreis's full-sized avatar

Humberto dos Reis Rodrigues humbertodosreis

View GitHub Profile
@FaKleiser
FaKleiser / CompactBundle.php
Last active June 26, 2023 07:42
CompactBundle for DDD applications with Symfony. See this blog post for more information: http://www.fabian-keller.de/blog/domain-driven-design-with-symfony-a-folder-structure
<?php
namespace Fk\Core\Infrastructure\Bundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* The compact bundle combines a bundle definition with an {@link ExtensionInterface} to provide sound defaults for
* implementing custom bundles.
*/
abstract class CompactBundle extends Bundle
@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
@diegonobre
diegonobre / symfony3-rest-api.md
Last active January 5, 2024 14:36 — forked from tjamps/README.md
Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authenticationu
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 3 framework. The following SF2 bundles are used :

@GNY-001F2
GNY-001F2 / NVInstall.md
Last active November 13, 2023 20:46
GUIDE: Installing Nvidia Drivers correctly on OpenSUSE Tumbleweed
## Prerequisite: You must either boot to your OS on runlevel 3, or you must manually disable all
## instances of the X server when running the NVIDIA installer.

# Check if you have the packman repository installed
$ zypper lr
# output will be like this:
#  | Alias                 | Name                  | Enabled | GPG Check | Refresh
---+-----------------------+-----------------------+---------+-----------+--------
 1 | RepoAlias             | RepoName              | Yes/No  | Yes/No    | Yes/No   
@ckressibucher
ckressibucher / cliserver.php
Last active November 10, 2023 17:58
Router script for PHP built in server
<?php
// public/cliserver.php (router script)
if (php_sapi_name() !== 'cli-server') {
die('this is only for the php development server');
}
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) {
// probably a static file...
return false;
<?php
final class GetProjectsController extends Controller
{
/**
* @var QueryObjectFactory
*/
private $queryObjectFactory;
/**
@gene1wood
gene1wood / all_aws_managed_policies.json
Last active May 29, 2024 05:17
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
This file has been truncated, but you can view the full file.
{
"APIGatewayServiceRolePolicy": {
"Arn": "arn:aws:iam::aws:policy/aws-service-role/APIGatewayServiceRolePolicy",
"AttachmentCount": 0,
"CreateDate": "2019-10-22T18:22:01+00:00",
"DefaultVersionId": "v6",
"Document": {
"Statement": [
{
"Action": [
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active May 13, 2024 13:31
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@tristanlins
tristanlins / iconv.docker
Created October 10, 2015 15:41
Docker PHP extension recipes
FROM php:5.6-cli
RUN apt-get update \
&& apt-get install -y \
libfreetype6-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install iconv \
&& apt-get remove -y \
libfreetype6-dev \
&& apt-get install -y \