Skip to content

Instantly share code, notes, and snippets.

View bruno-fernandes's full-sized avatar

Bruno Fernandes bruno-fernandes

  • Inoq Limited
  • London
View GitHub Profile
@bruno-fernandes
bruno-fernandes / array-diff-multidimensional-array.php
Created March 22, 2019 14:52
Difference between two multidimensional arrays in PHP
<?php
function arrayDiff($array1, $array2) {
$diffs = [];
foreach ($array2 as $k => $value) {
if (is_array($value)) {
$result = arrayDiff($array1[$k], $value);
if (!empty($result)) {
$diffs[$k] = $result;
}
[speakers ids="1156"]
@bruno-fernandes
bruno-fernandes / enable-ssl.sh
Last active August 29, 2015 14:25
Enable Laravel Homestead SSL support
#!/bin/sh
echo "Creating SSL folder and copying ssl certificate"
sudo mkdir /etc/nginx/ssl
sudo openssl req -nodes -new -x509 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj "/C=US/ST=NY/L=NYC/O=Dis/CN=www.mydomain.com"
echo "Updating conf files..."
confFiles="/etc/nginx/sites-available/*"
for confFile in $confFiles
do
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@bruno-fernandes
bruno-fernandes / .bash_profile
Last active January 4, 2016 13:49
.bash_profile
# run "source .bash_profile" to reload if doing mid session changes
#
# Aliases
#
alias home="cd ~/"
alias sites="cd /Applications/MAMP/htdocs/sites/"
alias hosts="sudo nano /private/etc/hosts"
alias ..="cd ../"
alias ...="cd ../../"
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your