Skip to content

Instantly share code, notes, and snippets.

View Rho-bur's full-sized avatar
💭
I may be slow to respond.

Robertino Vasilescu Rho-bur

💭
I may be slow to respond.
View GitHub Profile
@Rho-bur
Rho-bur / MockEntityManager.php
Created February 18, 2023 16:59 — forked from Taluu/MockEntityManager.php
Mock some services for PHPUnit
<?php
namespace Traits\Tests;
/**
* Mocks the entity manager
*
* Provides everything in the memory, so the tests does not depend on doctrine,
* which does a lot of stuff (maybe too much). This also allows to avoid to
* need and modify the data in the database, even if those are for the tests.
@mpdude
mpdude / fix-php-cs.yml
Created May 20, 2022 08:57
Run PHP-CS-Fixer on PRs and commit/push back changes
# .github/workflows/fix-php-cs.yml
on:
pull_request:
name: Coding Standards
jobs:
open-pr-for-cs-violations:
name: PHP-CS-Fixer
runs-on: ubuntu-20.04
@pablodz
pablodz / install_docker_in_ubuntu_21-10.sh
Last active June 17, 2023 20:58
Install Docker in Ubuntu 21.10, Install Dockercompose on Ubuntu 21.10
# [🟨OPTIONAL] Uninstall old docker versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Refresh latest version
sudo apt-get update
# Install pre-req
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
@mevdschee
mevdschee / ErrorReporting.php
Last active September 26, 2022 11:33
PHP error reporting class
<?php
class ErrorReporting
{
public static $errorMessage = 'Oops! Something went wrong.';
private static $cwd;
private static $debug;
/**
@0hsn
0hsn / .php-cs-fixer.php
Last active April 5, 2022 23:25
PHP-CS-Fixer v3.x migration guide for custom configuration
<?php
$config = new \PhpCsFixer\Config();
$config->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'multiline_whitespace_before_semicolons' => true,
@sindresorhus
sindresorhus / esm-package.md
Last active May 24, 2024 02:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
name: TagToRelease
on:
push:
tags:
- 'v*'
jobs:
build:
name: Process
runs-on: ubuntu-latest
steps:
@simonplend
simonplend / example-problem-detail-response.txt
Last active November 19, 2020 08:24
Example from RFC 7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807)
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
Content-Language: en
{
"type": "https://example.net/validation-error",
"title": "Your request parameters didn't validate.",
"invalid-params": [
{
"name": "age",
@shiv19
shiv19 / requestReview.js
Created August 7, 2020 05:09
Implementation of Google Play In-App Review API for NativeScript Apps
/*
https://developer.android.com/guide/playcore/in-app-review
In app reviews implementation for NativeScript Apps
Pre-requisites:
Add Google Play Core lib to your app.gradle's dependency list
app/App_Resources/Android/app.gradle ->
@neonexus
neonexus / Sails Schema Validation.md
Last active December 23, 2022 03:07
Sails Schema Validation

Sails Schema Validation

A bootstrap.js script designed to prevent Sails.js from lifting, in the event the database schema does not match the model definitions.

Perfect for preventing AWS ELB from deploying an incompatible version to production (requires using immutable deployments).

This is designed using native queries (MySQL), but likely can be easily adapted for most any adapter.

See https://github.com/neonexus/sails-react-bootstrap-webpack for an example.