Skip to content

Instantly share code, notes, and snippets.

View arielmagbanuazeald's full-sized avatar
🎯
Focusing

Ariel Magbanua arielmagbanuazeald

🎯
Focusing
View GitHub Profile
sshz extranetdb "mysqldump --single-transaction --opt --ignore-table=crm_zeald.accounts --ignore-table=crm_zeald.accounts_bugs --ignore-table=crm_zeald.accounts_contacts --ignore-table=crm_zeald.accounts_opportunities --ignore-table=crm_zeald.active_customers --ignore-table=crm_zeald.adodb_logsql --ignore-table=crm_zeald.agencies --ignore-table=crm_zeald.autosave --ignore-table=crm_zeald.billing --ignore-table=crm_zeald.billing_exports --ignore-table=crm_zeald.billing_exports_approval --ignore-table=crm_zeald.billing_exports_salesperson_2016_q3_model --ignore-table=crm_zeald.budgets --ignore-table=crm_zeald.bugs --ignore-table=crm_zeald.calls --ignore-table=crm_zeald.calls_contacts --ignore-table=crm_zeald.calls_resources --ignore-table=crm_zeald.calls_users --ignore-table=crm_zeald.campaign_costs --ignore-table=crm_zeald.campaigns --ignore-table=crm_zeald.cases --ignore-table=crm_zeald.cases_bugs --ignore-table=crm_zeald.cases_drafts --ignore-table=crm_zeald.catalog_domains --ignore-table=crm_zeald.change_
@BenSampo
BenSampo / deploy.sh
Last active April 2, 2025 09:01
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@DragonBe
DragonBe / Vagrantfile-php7.2
Created March 20, 2018 09:29
A quick Vagrant file to get started with PHP 7.2
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
@script = <<SCRIPT
# Fix for https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/1561250
if ! grep -q "ubuntu-xenial" /etc/hosts; then
echo "127.0.0.1 ubuntu-xenial" >> /etc/hosts
fi
@brunogaspar
brunogaspar / macro.md
Last active November 25, 2024 11:01
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active April 23, 2025 00:29
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@arielmagbanua
arielmagbanua / laravel-worker.conf
Last active January 16, 2019 01:41
laravel worker sample config file
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php home/vagrant/Code/lead_reactor/artisan queue:work database --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=vagrant
numprocs=8
redirect_stderr=true
stdout_logfile=home/vagrant/Code/lead_reactor/storage/logs/laravel-worker.log
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@rponte
rponte / get-latest-tag-on-git.sh
Last active December 9, 2024 00:27
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@gitaarik
gitaarik / git_submodules.md
Last active April 22, 2025 19:46
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}