Skip to content

Instantly share code, notes, and snippets.

View EpocSquadron's full-sized avatar

Daniel S Poulin EpocSquadron

View GitHub Profile
@EpocSquadron
EpocSquadron / Makefile
Created September 15, 2011 17:45 — forked from rgrove/Makefile
Simple Makefile to minify CSS and JS.
# Patterns matching CSS files that should be minified. Files with a -min.css
# suffix will be ignored.
CSS_FILES = $(filter-out %-min.css,$(wildcard \
public/css/*.css \
public/css/**/*.css \
))
# Patterns matching JS files that should be minified. Files with a -min.js
# suffix will be ignored.
JS_FILES = $(filter-out %-min.js,$(wildcard \
@EpocSquadron
EpocSquadron / PagifyingLists.js
Created January 23, 2012 20:36
Javascript to turn a list into pages with the elements displaced by one at a time -- with wrapping. Thought it was useful, then it wasn't. Maybe someday.
var list = target.find('li'),
listLen = list.length,
newDivs = '';
for (var i = 0; i < listLen; i++) {
newDivs += '<div>';
var iLeft = listLen - i,
// Simulate wrapping with slice
listSlice1 = list.slice(i + 1, i + 4),
@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:2918794
Created June 12, 2012 17:17
Count IP Addresses by Groups
GROUP BY SUBSTRING_INDEX('127.0.0.1', '.', 1/2/3)
@EpocSquadron
EpocSquadron / gist:2918965
Created June 12, 2012 17:42
Sublime Text 2 Default - User Configuration
{
"auto_complete_commit_on_tab": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"font_options":
[
"subpixel_antialias"
@EpocSquadron
EpocSquadron / .gitignore
Created June 15, 2012 14:16
Gitignore For Cache Directories
*
!.gitignore
@EpocSquadron
EpocSquadron / .txt
Created June 15, 2012 14:20
Better Gitignore for Web Projects (modified from h5bp)
# Numerous always-ignore extensions
*.bak
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
@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 / perm.sh
Created August 3, 2012 14:12
ExpressionEngine Permissions File
#!/bin/bash
# Find location of this script.
# This ensures that only files in the directory in
# which this script exists (recursively) are modified.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Set what the name of your expressionengine folders are.
SYSTEM="system"
IMAGES_DIR="public_html/images"
@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