Skip to content

Instantly share code, notes, and snippets.

View bgallagh3r's full-sized avatar

Brian Gallagher bgallagh3r

View GitHub Profile
@bgallagh3r
bgallagh3r / album-lightbox.php
Created March 2, 2014 17:18
All NextGen Galleries in Lightbox - Loads all galleries on a single page via lightbox instead of going to the actual gallery page. Just add the files appropriately then use this shortcode `[album id=0 template=lightbox]` id of 0 will force NGG to load all galleries. What I did instead however was set the default compact album to use the lightbox…
<?php
// /wp-content/themes/YOURTHEME/nggallery/album-lightbox.php
// To set this theme, go into Gallery > Gallery Settings and change the template to album-lightbox.
/**
Template Page for the album overview
Follow variables are useable :
$album : Contain information about the album
@bgallagh3r
bgallagh3r / DatabaseSeeder.php
Created January 30, 2014 04:07
Disable Foreign Key Constraints when Seeding DB with Artisan Migrate/DB Seed This prevents SQL from throwing errors when you try to do DB::table()->truncate() as TRUNCATE is disallowed when FK constraints are in place.
class DatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
@bgallagh3r
bgallagh3r / functions.php
Created January 21, 2014 19:21
Custom Excerpt class for Wordpress.
/*
|--------------------------------------------------------------------------
| Custom Excerpt
|--------------------------------------------------------------------------
*/
class Excerpt {
// Default length (by WordPress)
public static $length = 55;
@bgallagh3r
bgallagh3r / phpcs.sublime-settings
Created October 31, 2013 19:03
Comma separated exception list for PHP Mess Detector for short variable names like $id or other valid shortnames. I include this using Sublime PHPcs settings.
{
// other settings
// Execute phpmd
"phpmd_run": true,
// Execute the phpmd on file save
"phpmd_command_on_save": true,
// It seems python/sublime cannot always find the phpmd application
// If empty, then use PATH version of phpmd, else use the set value
@bgallagh3r
bgallagh3r / post-recieve
Created October 28, 2013 13:41
Make git run composer install/update after you push to remote server.
#!/bin/bash
DIR=$(git rev-parse --show-toplevel)
if [ -e "$DIR/composer.json" ]; then
if [ -d "$DIR/vendor" ]; then
composer.phar install
else
composer.phar update
fi
#!/bin/bash
# thanks http://www.jenssegers.be/blog/46/deploying-websites-with-git-and-composer-
# replace folder
cd "`dirname $0`/../../application/config"
# Check if a composer.json file is present
if [ -f composer.json ]; then
@bgallagh3r
bgallagh3r / .gitignore
Created August 23, 2013 15:32
Global Gitignore for my Dev Environment. Stuff that doesn't need to be in my per-project .gitignore ever.
# Use in home dir.
# use git config --global core.excludesfile "%USERPROFILE%\.gitignore"
# or git config --global core.excludesfile "~\.gitignore"
# Global Scope to ignore NON-project based files.
# WordPress
.htaccess
wp-config.php
wp-content/uploads/
wp-content/blogs.dir/
@bgallagh3r
bgallagh3r / composer-create-project.sh
Created August 22, 2013 01:33
Command to quickly set up a new Laravel 4 install. Just pass it the path to install. Eg. ccpl ~/dev/test or ccpl test to install in current directory.
#!/bin/bash
function ccpl () {
echo "Installing Laravel in" $1
composer create-project laravel/laravel $1 --prefer-dist
}
@bgallagh3r
bgallagh3r / Preferences.sublime-settings
Created July 26, 2013 15:27
User settings for Sublime Text 2 with comments for description.
{
// I change this frequently, which is why it's at the top, depending on project.
"draw_white_space": "none",
// Tell Folders from files easily
"bold_folder_labels": true,
// Phase makes it easier to identify where the cursor is without being all up in your grill.
"caret_style": "phase",
@bgallagh3r
bgallagh3r / ie10detect.js
Last active April 8, 2018 02:51
IE 10 detection. Since IE10 removed IE specific conditionals there is no real way to test for IE10. This is a simple script when added to the header will add the ie10 class to the HTML element.
// Add Version check for IE10 since they removed IE conditional statements
// Source: http://www.impressivewebs.com/ie10-css-hacks/
if (/*@cc_on!@*/false && document.documentMode === 10) {document.documentElement.className+=' ie10';}