Skip to content

Instantly share code, notes, and snippets.

View dugajean's full-sized avatar

Dugi dugajean

View GitHub Profile
@calebporzio
calebporzio / chain_helper.php
Last active July 23, 2023 04:27
Handy "chain()" helper method for making non-fluent classes/objects fluent.
<?php
function chain($object)
{
return new class ($object) {
protected $lastReturn = null;
public function __construct($object)
{
$this->wrapped = $object;
@MKagesawa
MKagesawa / docker-compose.yml
Created August 21, 2018 08:07
Docker-compose MySQL Image create multiple databases
# The official MySQL (https://hub.docker.com/_/mysql/) supports only one MYSQL_DATABASE environment variable.
# By modifying the entrypoint and passing shell script, you can create multiple dbs without having to make a mysql image just for this purpose.
version: '3'
services:
# Some other service connecting to mysql
db:
image: mysql:5.6
@noelbundick
noelbundick / LICENSE
Last active May 24, 2024 09:10
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active April 5, 2024 17:03
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
// ...
let webpack = require("webpack");
mix.webpackConfig({
plugins: [
// Choose the language you want to keep (Ex: "fr")
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
]
});
@jhoff
jhoff / Enums.php
Last active November 18, 2023 20:47
Laravel Model Enumeration Trait
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use App\Exceptions\InvalidEnumException;
trait Enums
{
/**
@mohandere
mohandere / yoast-seo-sitemap.php
Last active July 6, 2024 04:54
Wordpress yoast seo plugin, generate custom sitemap for custom URLS
<?php
/**
* Create a new custom yoast seo sitemap
*/
add_filter( 'wpseo_sitemap_index', 'ex_add_sitemap_custom_items' );
add_action( 'init', 'init_wpseo_do_sitemap_actions' );
// Add custom index
@staltz
staltz / introrx.md
Last active July 25, 2024 08:00
The introduction to Reactive Programming you've been missing
@wimvds
wimvds / test-composer-project-locally.md
Last active May 19, 2023 13:33
Test an existing composer project (create-project) locally

First, clone the repository of the project :

  mkdir /tmp/project-name
  git clone ...

Create a packages.json file in the root, containing the following :

@Ziumin
Ziumin / MockingDialogTest.php
Created July 26, 2012 09:22
[Symfony2] Mocking user input when testing commands
<?php
namespace XXX\ToolkitBundle\Tests\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use XXX\ToolkitBundle\Command\CommonGenerateCommand;