Skip to content

Instantly share code, notes, and snippets.

View wjn's full-sized avatar
Learning always

Will Nielsen wjn

Learning always
View GitHub Profile
@wjn
wjn / Git dmg uninstall.sh
Created February 27, 2014 15:55
This is the uninstall script provided with the Git Installer
if [ ! -r "/usr/local/git" ]; then
echo "Git doesn't appear to be installed via this installer. Aborting"
exit 1
fi
echo "This will uninstall git by removing /usr/local/git/**/*, /etc/paths.d/git, /etc/manpaths.d/git"
printf "Type 'yes' if you sure you wish to continue: "
read response
if [ "$response" == "yes" ]; then
sudo rm -rf /usr/local/git/
sudo rm /etc/paths.d/git
@wjn
wjn / XSLTHashGenerator.xslt
Created February 27, 2014 16:40
Generates an alpha numeric hash of a specified length using xslt 1. 0 and exlt math library.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:math="http://exslt.org/math"
extension-element-prefixes="math">
<xsl:template name="makeHash">
<xsl:param name="length">8</xsl:param>
<xsl:param name="count" select="$length"/>
<xsl:param name="hash"/>
<xsl:variable name="possibleFirst">xABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:variable>

Forms have been an integral part of any interactive site since the dawn of time, they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted, the website will take 'action' and do something with the data and then provide a user with the result. Symphony provides this logic layer via Events.

This tutorial assumes you have a basic understanding of how Events work in Symphony (if not, this may be a good introduction) and are semi comfortable writing some PHP code. I'll be showing you some of the lesser known features of Symphony Events, including event priority, event chaining and a brief demonstration of how to write a custom Event. The difficulty level progresses as we go through, but with any luck you'll be able to learn a thing or two :)

Getting Started

The Scenario

Our client requires a form that allows a user to submit some details about their new car purchase. Th

@wjn
wjn / .bowerrc
Last active August 29, 2015 13:57
.bowerrc
{
"directory" : "assets/lib"
}
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
{
"aar":
{
"int":["Afar"],
"native":["Afaraf"]
},
"aa":
{
"int":["Afar"],
"native":["Afaraf"]
@wjn
wjn / Helpful Linux Commands
Created May 4, 2015 15:13
Helpful Linux Commands
**Find Files by Date**
- `ll | grep '2014-12-27’`
- `ll | grep '2015-04-28’`
**Find Compressed Files**
- `find / -type f -exec file {} + | grep compress > compressed_files.txt` (prints to report file)
@wjn
wjn / Sample Apache2 Virtual Host
Last active August 29, 2015 14:20
Sample Apache2 Virtual Host
# domain: academicindexing.com
# public: /var/www/academicindexing.com/public/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin will@nielsendigital.com
ServerName www.academicindexing.com
ServerAlias academicindexing.com
# Index file and Document Root (where the public files are located)
@wjn
wjn / freshclam_log_error
Created May 25, 2015 21:25
/var/log/clamav/freshclam.log is locked by another process
## stop the daemon
# sudo /etc/init.d/clamav-freshclam stop
## manually start freshclam
# sudo freshclam -v
## restart daemon
# sudo /etc/init.d/clamav-freshclam start
@wjn
wjn / Apache2
Created June 14, 2015 03:42
Apache2 Optimization for 2GB Linode (/etc/apache2/apache2.conf)
# Make sure these settings are as follows:
KeepAlive Off
...
# for a 2 gb ram linode
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 12
MaxSpareServers 24