Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Gabriel Caruso carusogabriel

🏠
Working from home
  • Backend Software Engineer
  • Amsterdam - NL
View GitHub Profile
@sgolemon
sgolemon / git-gist
Created Jun 17, 2020
Command-line gist writer
View git-gist
#!/usr/local/bin/php
<?php
// Get a key from Github > Settings > Developer Settings > Personal Access Tokens
// Create a token with only the 'gist' permission.
const GISTKEY = '';
const GISTUSER = ''; // Put your github username here. Duh.
const GISTPOST = 'https://api.github.com/gists';
$headers = [
View void
rackspace/php-opencloud/lib/OpenCloud/Common/Metadata.php:40
In method __set():
return $this->setProperty($property, $value);
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:989
In method __set():
return $this->_[HDOM_INFO_OUTER] = $value;
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:992
In method __set():
return $this->_[HDOM_INFO_TEXT] = $value;
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:994
@matheusfaustino
matheusfaustino / phpbrew_change_by_dir.sh
Last active Apr 29, 2020
Zsh function to change php version per project (directory) using phpbrew
View phpbrew_change_by_dir.sh
# Add at the end of your .zshrc file
# After every command `cd`, it will check a ".phpbrew" file in the current directory and if it exists it will change the version of php automatically
# Create a .phpbrew file like this: `echo "7.4.4" > .phpbrew` in the folder you want to use the specific version of php
function phpbrew_change_by_dir() {
emulate -L zsh
if [ -f ".phpbrew" ]; then
PHPBREW_LOCAL_VERSION=$(cat .phpbrew);
COMMAND="phpbrew use ";
View README.md

Native mocks versus PHPUnit mocks

Mock type Tests duration
Native mocks 160.10 seconds
Mockery 177.01 seconds (+10%)
PHPUnit mocks 232.29 seconds (+45%)
Prophecy 3868.80 seconds (+2416%)
@anjesh
anjesh / php-source-exploration-process.md
Created Aug 14, 2017
Notes taken during php source exploration to identify weird error message
View php-source-exploration-process.md
@KINGSABRI
KINGSABRI / Powerline-shell-install-ubuntu.md
Last active Mar 25, 2021
Install Powerline-Shell on Ubuntu
View Powerline-shell-install-ubuntu.md

Environment

  • Kubuntu 16.04.2 TLS
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial
  • Shell environment: Bash
  • Terminal application : Konsole
@guilhermeblanco
guilhermeblanco / debug-fpm-segfaut.md
Created Jun 8, 2016
Debugging PHP-FPM segfaults
View debug-fpm-segfaut.md

Assuming PHP is compiled with debug enabled.

$ gdb /usr/sbin/php-fpm

Then:

r --nodaemonize --fpm-config /etc/php7/fpm/php-fpm.conf
@alcaeus
alcaeus / README.md
Last active Apr 19, 2021
Enable GPG for git commits
View README.md

Enable GPG for git commits

Generate a key

  1. Install gpg and gpg-agent: brew install gpg gpg-agent
  2. Generate a new key: run gpg --gen-key and follow the instructions
  3. Write down the ID of the key. To do this, run gpg --list-keys. The output will look like this:
pub   4096R/E9468C9A 2016-04-20 [expires: 2016-07-19]
uid                  Andreas B. <git@alcaeus.org>
@bastman
bastman / docker-cleanup-resources.md
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm