Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason McCallister jasonmccallister

View GitHub Profile
@jasonmccallister
jasonmccallister / appfog-php-apache-information
Created Oct 14, 2013
PHP Info and Apache Environment information for AppFog.
View appfog-php-apache-information
# 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 Oct 26, 2013
My Craft db.php configuration for AppFog.com
View db.php
<?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 Feb 3, 2014
Craft Plugin Developement - Forms Cheatsheet
View 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 Feb 26, 2014
Used in a Craft/Twig for loop to add a clear fix div after three entries.
View clearfix.twig
{% if loop.index is divisibleby(3) %}
<div class="clearfix"></div>
{% endif %}
View install.sh
#!/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 Mar 15, 2014
Modify getTitle in craft/app/widgets/QuickPostWidget.php to display the section title in lower case to match the widget title text.
View QuickPostWidget.php
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)));
}
View etc_nginx_global_php-restrictions.conf
# 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 Aug 29, 2015 — forked from fideloper/ngxhost.sh
My custom ngxhost.sh for vagrant. Forked from https://gist.github.com/fideloper/9063376
View ngxhost.sh
#!/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 Mar 23, 2014
CentOS Nginx Rep for vagrant
View nginx.repo
[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
Bash file to quickly install CentOS firewall rules
View firewall.sh
# 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
You can’t perform that action at this time.