Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @return void
* @param $var The variable passed
* @param string $label
* @param integer limit The limit for each
* @param string $path
*/
public function log($var,$label=null,$limit =2,$path = null)
{
function zerofill(length,number){
return new Array(length - number.toString().length + 1).join('0') + number;
}
@victordit
victordit / switch-php.sh
Created October 25, 2017 14:46
Script to switch version of php on fly in development enviroment
#!/bin/bash
###
#
# Script to switch version of php on fly in development enviroment
# Inspired by https://www.tecmint.com/install-different-php-versions-in-ubuntu/
# *REQUIRED sudo privileges
###
vd="PHP Version => "
@victordit
victordit / gist:3e41c634721874574134ce050f37d40f
Created November 17, 2017 18:25 — forked from Steven-Rose/gist:3943830
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
#!/bin/bash
#config
sites_available="/etc/apache2/sites-available/"
sites_enabled="/etc/apache2/sites-enabled/"
site_default="000-default.conf"
domain_default="localhost"
path_default="/var/www/html"
hosts="/etc/hosts"
local_ip="127.0.0.1"
@victordit
victordit / sylius_delete_customers_and_orders.sql
Last active December 19, 2017 13:21
Delete all fake data (orders and customers) via sql query | Sylius 1.0.4
--
-- Delete all fake data via mysql query
-- Sylius 1.0.4
--
-- Disable foreign key chek
SET FOREIGN_KEY_CHECKS=0;
-- Delete Orders
TRUNCATE `sylius_adjustment`;
@victordit
victordit / .bashrc
Created December 13, 2018 14:33
git branch in linux profile
## Edit your profile
vim ~/.bashrc
## Add the follow code after last line
## git branch in prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@victordit
victordit / git.migrate
Created July 31, 2019 14:21 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@victordit
victordit / curl.md
Created December 10, 2019 15:57 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.