Skip to content

Instantly share code, notes, and snippets.

View jasonmccallister's full-sized avatar

Jason McCallister jasonmccallister

View GitHub Profile
@jasonmccallister
jasonmccallister / appfog-php-apache-information
Created October 14, 2013 23:48
PHP Info and Apache Environment information for AppFog.
# Apache Environment Variables
The following environment variables are available through phpinfo().
* VCAP_SERVICES
* HTTP_HOST
* HTTP_X_FORWARDED_FOR
* HTTP_CONNECTION
* HTTP_ACCEPT
* HTTP_ACCEPT_ENCODING
@jasonmccallister
jasonmccallister / db.php
Created October 26, 2013 20:23
My Craft db.php configuration for AppFog.com
<?php
/**
* Database Configuration
*
* All of your system's database configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php
*/
if ($_SERVER['HTTP_HOST'] == 'local.domainname.com') {
@jasonmccallister
jasonmccallister / cheatsheet
Created February 3, 2014 16:16
Craft Plugin Developement - Forms Cheatsheet
#Craft Plugin Developement - Forms Cheatsheet
My quick reference for working with forms while developing plugins for Craft.
###checkbox
* id
* class
* name
* checked
@jasonmccallister
jasonmccallister / clearfix.twig
Created February 26, 2014 05:12
Used in a Craft/Twig for loop to add a clear fix div after three entries.
{% if loop.index is divisibleby(3) %}
<div class="clearfix"></div>
{% endif %}
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@jasonmccallister
jasonmccallister / QuickPostWidget.php
Created March 15, 2014 01:31
Modify getTitle in craft/app/widgets/QuickPostWidget.php to display the section title in lower case to match the widget title text.
public function getTitle()
{
if (craft()->hasPackage(CraftPackage::PublishPro))
{
$section = $this->_getSection();
if ($section)
{
return Craft::t('Post a new {section} entry', array('section' => strtolower($section->name)));
}
# Don't throw any errors for missing favicons and don't display them in the logs
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Don't log missing robots or show them in the nginx logs
location = /robots.txt {
allow all;
log_not_found off;
@jasonmccallister
jasonmccallister / ngxhost.sh
Last active August 29, 2015 13:57 — forked from fideloper/ngxhost.sh
My custom ngxhost.sh for vagrant. Forked from https://gist.github.com/fideloper/9063376
#!/usr/bin/env bash
if [ $EUID -ne 0 ]; then
echo "You must be root: \"sudo ngxvhost\""
exit 1
fi
# May need to run this as sudo!
# I have it in /usr/local/bin and run command 'ngxvhost' from anywhere, using sudo.
@jasonmccallister
jasonmccallister / nginx.repo
Created March 23, 2014 23:51
CentOS Nginx Rep for vagrant
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6.5/$basearch/
gpgcheck=0
enabled=1
@jasonmccallister
jasonmccallister / firewall.sh
Created May 4, 2014 18:18
Bash file to quickly install CentOS firewall rules
# flush all rules
iptables -F
# block null packets
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
# block syn-flood attacks
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
# block XMAS packets