Skip to content

Instantly share code, notes, and snippets.

View kevinsmith's full-sized avatar

Kevin Smith kevinsmith

View GitHub Profile
<?php
function runCommand ()
{
$command = 'php artisan queue:work --daemon --env=prod > /dev/null & echo $!';
$number = exec($command);
file_put_contents(__DIR__ . '/queue.pid', $number);
}
if (file_exists(__DIR__ . '/queue.pid')) {
@kevinsmith
kevinsmith / sandsync.sh
Created November 18, 2014 22:51
Script to sync staging (sandbox) DB and file uploads with local environment
#!/bin/sh
#
# sandsync.sh
#
# This is a shell script for keeping sandbox and local EE
# environments in sync. It takes a backup of a project's sandbox database,
# clears the local database and imports the remote's backup into local,
# and performs a one-way sync of the uploads directory from remote to local.
# Drop it in the directory above your version-controlled projected directory.
@kevinsmith
kevinsmith / 0_reuse_code.js
Created April 25, 2014 02:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kevinsmith
kevinsmith / MY_Email.php
Created February 18, 2012 23:13
Add a "Vanity To" option to CodeIgniter's Email Class
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Email extends CI_Email {
/**
* Set Vanity To address
*
* The Vanity To address is the address that is shown in the recipient's email
* program, not the address to which the email is routed.
*
@kevinsmith
kevinsmith / ownersbox.js
Created April 21, 2011 21:32
Some JS to allow a dropdown panel to slide out as long as the link's class name matches the panel's ID name.
$(document).ready(function(){
// Owner's Box animation
$('#owners_box ul a, .outside_donations').click(function() {
$('#dimmedBG').fadeIn(150);
var className = $(this).attr("class");
var idName = "#"+className;
$('.owners_dropdown').not(idName).fadeOut(100, function() {
$(idName).slideDown(400, function() {
if (idName == "#outside_donations") { $('input.donation').focus(); }
});
/*
| This is not the full database file, but the relevant modifications
| only. You'll need a database group for each of the servers involved
| in your EE project (i.e. dev, staging, production). Info here:
| http://codeigniter.com/user_guide/database/configuration.html
|
| Remember: the if/then statement below that defines $active_group will
| only work if you've modified your constants.php file according to this
| gist: http://gist.github.com/591155
*/
/*
| Helps determine which settings to use based on the current server.
| Add this to the top of the constants.php file just under the
| opening php tag and copy it over everything down to just above
| the 'File Stream Modes' section. Modify the switches below as
| needed, and add as many switches as your setup requires.
*/
switch($_SERVER['HTTP_HOST'])
{
/*
| This is not the full config file, but the relevant parts that need to be
| added in order to make it dynamic between servers. This file's set-up was
| inspired by Matt Weinberg's fantastic article on EE Insider:
| http://eeinsider.com/articles/multi-server-setup-for-ee-2/
|
| I'd like to think I've tweaked it a bit to improve it.
|
| Variables defined here will override anything submitted through the CP,
| so you can be sure these take top priority. Be sure to remove the 'cp_url',
#!/bin/bash
# Copyright (c) 2010 hearSAY, LLC @ http://gohearsay.com
# Author: Kevin Smith
#
# This script is meant to be installed in the web root directory
# and run immediately after an EE2 deployment. As long as it's
# installed in the web root, it can be executed from any working
# directory.
# VERY IMPORTANT: If you are running under a suPHP environment