Skip to content

Instantly share code, notes, and snippets.

View acelaya's full-sized avatar
🖥️
Coding

Alejandro Celaya acelaya

🖥️
Coding
View GitHub Profile
<?php
declare(strict_types=1);
use Doctrine\ORM\EntityManagerInterface;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\Proxy\VirtualProxyInterface;
use Psr\Container\ContainerInterface;
use Swoole\ArrayObject;
use Swoole\Coroutine;
@chrodriguez
chrodriguez / dockerhub-readme-update.sh
Last active November 10, 2022 21:39
How to update dockerhub readme automatically
#!/bin/bash
usage() {
if [ ! -z $1 ]; then
echo -e "ERROR:\n" 1>&2
fi
echo "Usage: $0 -f /path/to/README.md -u dockerhub-username [-r dockerhub-repo-prefix] -n repo-name" 1>&2
exit 1;
}
while getopts ":r:u:f:n:" o; do
@jhorsman
jhorsman / semver-regex.md
Last active March 29, 2024 05:25
Semantic versioning regex
@Swader
Swader / qprw.php
Created June 14, 2015 10:42
qprw.php
$function = new Twig_SimpleFunction('qprw', function (array $replacements) {
parse_str($_SERVER['QUERY_STRING'], $qp);
foreach ($replacements as $k => $v) {
$qp[$k] = $v;
}
return '?'.http_build_query($qp);
});
<?php
namespace jkuchar\Doctrine\DBAL\Driver\PDOPgSql;
use Doctrine\DBAL\Driver\PDOPgSql\Driver as DoctrineOriginalDriver;
/**
* Adds ability to set search path to PostgreSQL driver
* @package App\Doctrine
<?php
use GuzzleHttp\Post\PostFile;
$request = $client->createRequest('POST', 'http://example.com/');
$postBody = $request->getBody();
$readStream = $flysystem->readStream($fileLocation);
$postBody->addFile(new PostFile('test', $readStream);
$response = $client->send($request);
@stefansundin
stefansundin / git-bundle-hook.md
Last active February 1, 2024 06:42 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
#!/usr/bin/env php
<?php
define('MIGRATIONS_DIR', 'app/DoctrineMigrations');
list(, $previousHead, $currentHead) = $argv;
$excessMigrations = getExcessMigrations($previousHead, $currentHead);
rsort($excessMigrations);
removeExcessMigrations($excessMigrations, $previousHead);
addMissingMigrations();
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 9, 2024 06:43
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname