Skip to content

Instantly share code, notes, and snippets.

View mcustiel's full-sized avatar
🧉

Mariano Custiel mcustiel

🧉
  • Hamburg, Deutschland
View GitHub Profile
@mcustiel
mcustiel / atm.go
Created December 13, 2022 21:17
Simple ATM Logic in Golang
package main
import "fmt"
type AtmValue struct {
Val int
Count int
}
type ATM []AtmValue
@mcustiel
mcustiel / IterableParallelProcessing-Test.php
Last active January 5, 2020 12:35
Php Parallel Processing
<?php
namespace Mcustiel\Parallel\Arrays;
class IterableParallelProcessing
{
const CHILD_STREAM_INDEX = 1;
const PARENT_STREAM_INDEX = 0;
const PROCESSES_WAIT_MICROSECONDS = 3000;
@mcustiel
mcustiel / random-chuck-fact.sh
Last active February 20, 2023 13:04
Random chuck norris fact
#!/usr/bin/env bash
api=https://api.chucknorris.io/jokes/random
contents=$(curl -s $api)
if [ "$(echo $contents | jq -r '.value')" != "" ] ; then
echo $(echo $contents | jq -r '.value')
fi
@mcustiel
mcustiel / index.php
Created June 28, 2019 14:00
Learning templado
<?php
require_once __DIR__ . '/../vendor/autoload.php';
//echo "PUBLIC INDEX";
//var_dump($_SERVER);
class ViewModel {
private $pageTitle = "I am the title";
public function pageTitle() {
#!/usr/bin/env bash
set -e
set -o
YES="1"
NO="0"
EMPTY=""
FORCE_DB_INSTALL=${NO}
@mcustiel
mcustiel / IntegrationDbSuitesListener.php
Created May 27, 2019 12:22
PHPUnit listener for to run migrations on symfony
<?php
namespace AppBundle\Tests\Repository\PHPUnit;
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
use Exception;
use PHPUnit_Framework_BaseTestListener;
use PHPUnit_Framework_Test;
use PHPUnit_Framework_TestSuite;
@mcustiel
mcustiel / gcommit
Last active July 13, 2021 13:31
Useful scripts
#!/bin/bash
MESSAGE=$1
# Idiot filter
if [ "$MESSAGE" = "-m" ]; then
MESSAGE=$2
fi
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
@mcustiel
mcustiel / checklist.md
Last active July 13, 2021 14:56
Code reviews checklist

1 - Tests are written for the changes

2 - Covers annotation

3 - Naming

  1. Classes
  2. Methods
  3. Properties
  4. Variables
  5. Constants
  6. Namespaces

4 - Constants are available instead of magic values

# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# hosts@someonewhocares.org
@mcustiel
mcustiel / namespace.js
Last active December 11, 2017 09:19
Learning proper JS
var mcustiel = mcustiel || {
isNamespace: function () {
return true;
},
Namespace: (function (root) {
function NamespaceConstructor (root) {
var isNamespace = function (object) {
return object.isNamespace && object.isNamespace()
},