This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// counting values | |
var_dump(count(array())); // 0 | |
var_dump(count(false)); // 1 | |
var_dump(count(true)); // 1 | |
var_dump(count(null)); // 0 | |
var_dump(count(1)); // 1 | |
var_dump(count(0)); // 1 | |
var_dump(count('asdf')); // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: PHP Mailer Override | |
Version: 1.0.0 | |
Description: Override config for development environment. | |
Author: Timothée Moulin | |
Author URI: https://timothee-moulin.me/ | |
*/ | |
defined( 'ABSPATH' ) OR exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Timothée Moulin | |
# | |
# Install : copy this script anywhere (you can place it in the (/usr/local/bin) directory | |
# and give it the execution permission : chmod +x convert-8859-utf8.sh | |
# | |
# You can use this script either by calling it directly to convert a single file | |
# or you can give it to the "find -exec" command to convert a batch of files. | |
# e.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$foo = new StdClass(); | |
$foo->bar = new StdClass(); | |
$foo->bar->baz = 'toto'; | |
// this contains the main object | |
var_dump($foo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Timothée Moulin | |
# | |
# Install : copy this script anywhere (you can place it in the (/usr/local/bin) directory | |
# and give it the execution permission : chmod +x convert-db-latin-utf8.sh | |
# | |
# You must call this script and give it the following parameters. | |
# 1) [required] database user | |
# 2) [required] database name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include this snippet in your .zshrc or .bashrc file to compile multiple ssh config files into one. | |
# Put the file anywhere and source it from your .zshrc or .bashrc file with : source /path/to/ssh-compile | |
# This can be useful if you share a config file among several people like in your company and also some private hosts. | |
# call ssh-compile-config to get all the files matching ~/.ssh/.config* and combine them into the final ~/.ssh/config file | |
alias ssh-compile-config='echo -n > ~/.ssh/.config && cat ~/.ssh/config* > ~/.ssh/.config' | |
ssh-compile-config | |
# fetch all the configured hosts | |
h=() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $i; | |
$i = 0; | |
function test() { | |
global $i; | |
var_dump(++$i); | |
return $i; | |
} | |
switch (test()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell Custom Functions | |
# Timothée Moulin | |
# | |
# Change directory to the root workspace directory | |
Function tim-goto-workspace-tim { | |
cd ~/www | |
ls | |
} | |
Set-Alias -Name www -Value tim-goto-workspace-tim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// undefined variable | |
echo "?? prints 'default'"; | |
echo "<br>"; | |
var_dump($a ?? 'default'); | |
echo "<br><br>"; | |
echo "?: sends a notice 'undefined variable' and prints 'default'"; |
OlderNewer