Skip to content

Instantly share code, notes, and snippets.

@tarranjones
tarranjones / multiple_ssh_setting.md
Last active Oct 3, 2019 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts
View multiple_ssh_setting.md

Multiple SSH Keys settings for different git account

Create different public keys

Create different ssh keys for each git account

@tarranjones
tarranjones / phpstorm-eap-update
Created Mar 6, 2018 — forked from AubreyHewes/phpstorm-eap-update
Update/Install the latest PhpStorm EAP automatically (add to external tools)
View phpstorm-eap-update
#!/usr/bin/env bash
#######################################################################################################################
#
# Updates/Install the latest PhpStorm EAP
#
# --------------------------------------------------------------------------------------------------------------------
#
# * Retrieves the current version from the EAP wiki
# * If the new version is not the current version (based on symlink to PhpStorm) then updates
# * Creates a symlink from versioned folder to PhpStorm
View parent child get method name
<?php
//
//class ParentClass
//{
// public function getClassName()
// {
// return get_called_class() === (new \ReflectionMethod(get_called_class(), __FUNCTION__))->getDeclaringClass()->getName();
// }
//
// public function getClassNameDoesntExist()
View VatValidator.php
<?php
function is_valid_regex($vat,$country){
// current regex function
return true;
}
function validate_vat($vat,$country){
if(is_valid_regex($vat,$country)) {
@tarranjones
tarranjones / ssh_keygen.sh
Created Mar 2, 2017
ssh keygen stuff functions
View ssh_keygen.sh
# https://github.com/curtisalexander/til/blob/master/cl/ssh-config.md
# host="${1#*@}"
# user="${1%@*}"
function ssh_keygen(){
ssh-keygen -t rsa -b 4096 -N "" -C "$USER@$HOSTNAME to $1" -f ~/.ssh/"$1_id_rsa"
pub_key $1
}
function pub_key(){
@tarranjones
tarranjones / move_git_repo.sh
Created Feb 16, 2017
How to Move a Git Repo
View move_git_repo.sh
mkdir -p ~/prestine/ #stores prestine git repos, no dev happens here (mostly just used for phpstorm framework intergartion)
move_repo(){
rm -fr ~/prestine/$2
git clone https://$1.git ~/prestine_repos/$2
cd ~/prestine_repos/$2
git remote set-url origin https://$2.git
git push origin master
cd -
@tarranjones
tarranjones / move_git_repo.sh
Created Feb 16, 2017
How to Move a Git Repo
View move_git_repo.sh
mkdir -p ~/prestine/ #stores prestine git repos, no dev happens here (mostly just used for phpstorm framework intergartion)
move_repo(){
rm -fr ~/prestine/$2
git clone https://$1.git ~/prestine_repos/$2
cd ~/prestine_repos/$2
git remote set-url origin https://$2.git
git push origin master
cd -
@tarranjones
tarranjones / .extract.function
Last active Feb 1, 2017
# Extract archives - use: extract <file>
View .extract.function
# Based on http://dotfiles.org/~pseup/.bashrc
function extract() {
if [ -f "$1" ] ; then
local filename=$(basename "$1")
local foldername="${filename%%.*}"
local fullpath=`perl -e 'use Cwd "abs_path";print abs_path(shift)' "$1"`
local didfolderexist=false
if [ -d "$foldername" ]; then
didfolderexist=true
@tarranjones
tarranjones / require_gist.sh
Created Jan 6, 2017
How to require a Gist using Composer
View require_gist.sh
add_gist_repository(){
composer config repositories.$1 '{"type":"package","package": {"name": "'$1'","version": "master","source": {"url": "https://gist.github.com/'$1'.git","type": "git","reference":"master"},"autoload": {"classmap": ["."]}}}'
}
require_gist(){
add_gist_repository $1
composer require $1:dev-master
}
@tarranjones
tarranjones / archive_repo.sh
Created Jan 6, 2017
Archives a a git repository in $HOME/{hostname}/{username}/{repository} and optionally creates a symlink to the git directory
View archive_repo.sh
archive_repo(){
mkdir -p ~/$1
if ! git -C ~/$1 pull; then
git clone https://$1.git ~/$1
fi
if [ ! -z "$2" ]; then
mkdir -p $2
rm -rf $2