Skip to content

Instantly share code, notes, and snippets.

View gunjanpatel's full-sized avatar

Gunjan Patel gunjanpatel

View GitHub Profile
@gunjanpatel
gunjanpatel / git-beautify.md
Last active May 8, 2018 07:23
Setup Git short codes and terminal them to show branch and path

Git short commands

You can enable short commands by updating your home .gitconfig file. Goto /home/{user}/.gitconfig file and add contents from https://gist.github.com/gunjanpatel/10019184 file.

Beautify terminal for git commands

1. Create the files which you will need to copy later from git repository

touch ~/.git-completion.bash
touch ~/.git-prompt.sh
@gunjanpatel
gunjanpatel / filter.md
Last active September 25, 2015 04:55
joomla method to filter username string
<?php
$string = 'Hello $ World/';
$username = JFilterInput::getInstance()->clean($string, 'USERNAME');
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup
@gunjanpatel
gunjanpatel / user.md
Created April 22, 2015 07:24
trigger joomla user plugin from your component

Using following code you can trigger any joomla user plugin event in your component

JPluginHelper::importPlugin('user', 'contactcreator');

JDispatcher::getInstance()->trigger(
	'onUserAfterSave', 
	array(
 $user, 
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@gunjanpatel
gunjanpatel / phpdoc.md
Created February 6, 2015 06:44
phpdoc generator or creator command

phpdoc -d "." -t "/var/www/html/redshopdoc/responsive-twig" --template="responsive-twig"

@gunjanpatel
gunjanpatel / elasticbeanstalk.md
Last active August 29, 2015 14:12
amazon elastic beanstalk update environment

Amazon Elastic Beanstalk update file using git

  1. Create folder named as .elasticbeanstalk and create files named config and aws_credentials in the same folder.

    1. config
    [global]
    

ApplicationName=

@gunjanpatel
gunjanpatel / gist:b083dff8a0f49f9a02d5
Created October 19, 2014 05:52
postgresql installation on ubuntu
http://www.ubuntugeek.com/howto-setup-database-server-with-postgresql-and-pgadmin3.html
@gunjanpatel
gunjanpatel / getshoppergroup.php
Last active August 29, 2015 14:06
get redshop shopper group from joomla user id
<?php
require_once JPATH_SITE . '/components/com_redshop/helpers/user.php';
$rsUserhelper = new rsUserhelper;
$shopperGroupId = (int) $rsUserhelper->getShopperGroup(JFactory::getUser()->id);
$shopperGroup = $rsUserhelper->getShoppergroupData(JFactory::getUser()->id);