Skip to content

Instantly share code, notes, and snippets.

View fideloper's full-sized avatar
🏠
Working from home

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
@airways
airways / mod.extendedchannel.php
Created October 28, 2011 15:52
ExpressionEngine: Extending a core or third party module or plugin
<?php
class ExtendedChannel {
public __construct()
{
$this->EE = &get_instance();
}
public function extended_entries()
{
@HansCz
HansCz / list_apache2_vhosts.bash
Created April 13, 2012 11:30
Apache (Bash) - List apache2 virtualhosts
# List apache2 virtualhosts
# Lists virtualhosts currently enabled for apache2,
# showing the ServerName:port, conf file and DocumentRoot
/usr/sbin/apache2ctl -S 2>&1 | perl -ne 'm@.*port\s+([0-9]+)\s+\w+\s+(\S+)\s+\((.+):.*@ && do { print "$2:$1\n\t$3\n"; $root = qx{grep DocumentRoot $3}; $root =~ s/^\s+//; print "\t$root\n" };'
@EpocSquadron
EpocSquadron / .htaccess
Created May 8, 2012 15:39
Htaccess snippet for selective simple auth on staging environment.
# ##############################################################################
# # HTTP AUTH FOR NON-PRODUCTION PUBLIC SITES #
# ##############################################################################
# Set environment variable based on Host
SetEnvIfNoCase Host \.local(:80)?$ APPLICATION_ENV=development
SetEnvIfNoCase Host ^(www\.)?stagingaddress\.com(:80)?$ APPLICATION_ENV=staging
SetEnvIfNoCase Host ^(www\.)?productionaddress\.com(:80)?$ APPLICATION_ENV=production
# Check for staging so we can set DENIABLE_HOST variable
@EpocSquadron
EpocSquadron / gist:2936983
Last active October 6, 2015 04:37
Web Project Best Practices

Web Project Best Practices

Proper Gitignoring

When starting a project, or joining a project that hasn't done this yet, the first thing you should do is set up proper gitignore files. There should be a master gitignore in the project root based on the h5bp master gitignore, and a cache dir specific gitignore in each cache directory. Without proper gitignoring, junk files tend to find their way into commits and removing them becomes a pain, as everyone gets modified/removed conflicts forever after. The reasoning behind using a gitignore file for each cache folder separately instead of including path/to/cache_dir/* in the master gitignore is that git is inconsistent in whether the folder itself is actually stored in the remote git repo. It is most consistent to have gitignores ignoring all but themselves in each cache directory. Then that directory must always be in the remote repo in order to contain the .gitignore file.

@EpocSquadron
EpocSquadron / git-deshitifer.sh
Created August 3, 2012 16:02
Remove files from a repo that should be ignored but you dont neccesarily want to delete from filesystem.
#!/bin/bash
# Regexes matching files and folders in the gitignore that should never be in a repo.
GITIGNORE_REGEXES=( ".+\.(diff|err|orig|log|rej|swo|swp|vi|sass-cache|sublime-project|sublime-workspace|komodoproject|esproj|espressostorage|rbc)" ".+\~" "\.\/\.(DS_Store|_.+|cache|project|settings|tmproj|komodotools|hg|svn|CVS|idea)" "\.\/(nbproject|Thumbs\.db|_notes|dwsync\.xml)" )
# Get rid of them in git, leave them in filesystem.
for REGEX in "${GITIGNORE_REGEXES[@]}"; do
FILES=`find -E . -iregex "$REGEX" | sed 's/^..//;' | tr '\n' ' '`
echo "## Regex: $REGEX"
if [ ! "$FILES" = "" ]; then
@dhrrgn
dhrrgn / foo.py
Last active December 25, 2015 21:49
Why am I not getting the full git clone output here?
# assume all imports are done
#Old: proc = subprocess.Popen(['git', 'clone', '[url here]'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Fixed
proc = subprocess.Popen(['git', 'clone', '--progress' '[url here]'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
while proc.poll() is None:
@dhrrgn
dhrrgn / elasticsearch.yml
Last active January 2, 2016 12:29
ElasticSearch Install
cluster.name: "my-es"
index.number_of_shards: 5
index.number_of_replicas: 1
cloud:
aws:
region: us-east-1
access_key: <key here>
secret_key: <secret here>
@pjv
pjv / hhvm.conf
Last active January 18, 2016 18:04
Ubuntu 14.04 upstart script for HHVM
# hhvm - HipHop VM
#
# The HipHopVM server provides a high performance PHP stack and web server.
# modified by pjv from original found here: http://stackoverflow.com/questions/19013516/upstart-script-for-hhvm-hiphop
description "HHVM server"
author "pjv https://gist.github.com/pjv/2e9ab32d8d9884bf79a4"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
@NoodlesNZ
NoodlesNZ / Jenkinsfile
Created April 11, 2017 23:08
PHP Pipeline
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
sh 'rm -rf build/{logs,pdepend}'
@EpocSquadron
EpocSquadron / .gitconfig
Created April 5, 2013 16:10
My global git config
[core]
# Don't track permissions other than standard modes.
filemode = false
# Don't ignore File -> file changes.
ignorecase = false
# Vim is better.
editor = vim
[color]
ui = true
[help]