Skip to content

Instantly share code, notes, and snippets.

View shawn-crigger's full-sized avatar

Shawn Crigger shawn-crigger

View GitHub Profile
@shawn-crigger
shawn-crigger / 0_reuse_code.js
Created June 8, 2014 04:59
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
@shawn-crigger
shawn-crigger / jquery.ajax.progress.js
Last active February 24, 2021 18:28 — forked from db/jquery.ajax.progress.js
Creating a jQuery File Upload Progress meter
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: function() { console.log("standard progress callback"); },
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);
<?php
// set the url of the page you would have previously linked to in the iframe
//$url = 'http://www.website-to-request.com/';
$url = 'http://www.example.com/';
// Setup the new css you want to inject into the page
$css = '
<style type="text/css">
<?php
/**
* Run PHP-Markdown[-Extra] [-x], optionally adding automatic IDs [-a],
* and a table of contents [-ac].
*
* @copyright 2012-09-07 N.D.Freear.
*/
if (php_sapi_name() != 'cli') {
_error('must be in CLI mode.');
@shawn-crigger
shawn-crigger / osx-10.10-setup.md
Last active September 5, 2015 01:34 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@shawn-crigger
shawn-crigger / osx-for-hackers.sh
Last active March 17, 2017 00:41 — forked from matthewmueller/osx-for-hackers.sh
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@shawn-crigger
shawn-crigger / cronjoblock
Created February 11, 2016 03:00 — forked from coderofsalvation/cronjoblock
cronjob wrapper with locking support
#!/bin/bash
# portable cronjob wrapper to ensure :
#
# * only one process at the time (prevents process-overlap, handy for unique cron workers)
# * reverse cron's email behaviour (only emails on error)
# * ultraportable: only reliest on flock, not on debians 'start-stop-daemon' or centos 'daemon'
# * nicelevel to tame cpu usage
#
# usage: cronjoblock <application> [args]
# example: cronjoblock /home/foo/myscript &
@shawn-crigger
shawn-crigger / alias-completion
Created August 28, 2016 16:37 — forked from ckorn/alias-completion
Bash auto-completion with aliases. Aliases are nice to shorten often used commands. But ever got frustrated when bash's tab completion did not work? Instead of "git checkout" I just type "go". But I also want to type "go m<tab>" to get completed to "go master" automatically. This script creates a wrapper function to be used with the alias. (Also…
/usr/local/bin/make-completion-wrapper:
#!/bin/sh
# Author.: Ole J
# Date...: 23.03.2008
# License: Whatever
# Wraps a completion function
# make-completion-wrapper <actual completion function> <name of new func.> <alias>
# <command name> <list supplied arguments>
# eg.
@shawn-crigger
shawn-crigger / PhraseContext.php
Created September 27, 2016 22:21 — forked from litzinger/PhraseContext.php
This is an example of a old EE 2 method in my Publisher add-on and how I converted it to EE 3. I've also included the Behat unit(ish) tests so far for the model. For more information on that see https://github.com/litzinger/ee-behat
<?php
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use Publisher\Model\Phrase;
use Publisher\Model\PhraseGroup;
use Publisher\Model\PhraseTranslation;
use Publisher\Service\Request;
class PhraseContext implements Context
{
@shawn-crigger
shawn-crigger / error_php.php
Created September 27, 2016 22:30
Better Error PHP file for ExpressionEngine ./system/expressionengine/errors/error_php.php
<div style="border:1px solid #990000;padding:20px;margin:10px;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<p><hr/><?php
$e = new Exception();