Skip to content

Instantly share code, notes, and snippets.

View catchamonkey's full-sized avatar
👨‍💻

Chris Sedlmayr catchamonkey

👨‍💻
View GitHub Profile
@catchamonkey
catchamonkey / mailtoLinkTracking.js
Created May 30, 2012 08:41
Infinity Tracking - Custom Trigger for all mailto links
/**
* Registers a click handler for all mailto links on the page and fires
* an Infinity Tracking custom trigger when clicked
* We use 'live' for mailto links loaded after the DOM is ready
* @author Chris Sedlmayr <chris.sedlmayr@infinity-tracking.com>
*/
// copy of initialise the infinity var
var _ictt = _ictt || [];
$(document).ready(function() {
// find 'a' elements that have an href starting with mailto:
@catchamonkey
catchamonkey / placeholder.js
Created April 5, 2013 14:22
JavaScript placeholder polyfill.
function isPlaceholderSupported() {
var input = document.createElement("input");
return ('placeholder' in input);
}
var placeholdersupport = isPlaceholderSupported();
// find the elements that are advertising this behaviour
// then setup each one
$("[data-behaviour='placeholder']").each(function() {
@catchamonkey
catchamonkey / logicalOrTest.php
Created November 22, 2012 11:33
Logical Or test
$constraint = $this->logicalOr(
$this->equalTo('foo'), $this->equalTo('bar')
);
$this->assertThat('foo', $constraint);
@catchamonkey
catchamonkey / setfacl.sh
Created October 24, 2012 11:32
Fedora setfacl within a Symfony project for cache and log dirs
sudo setfacl -R -m u:apache:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:apache:rwx -m u:`whoami`:rwx app/cache app/logs
@catchamonkey
catchamonkey / gist:3600265
Created September 2, 2012 15:10
Symfony2.1.0-RC2 Install Problem
$ php ../composer.phar install
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for jms/di-extra-bundle == 1.1.9999999.9999999-dev -> satisfiable by jms/di-extra-bundle 1.1.x-dev.
- Can only install one of: jms/di-extra-bundle dev-master, jms/di-extra-bundle 1.1.x-dev.
- Installation request for jms/di-extra-bundle == 9999999-dev -> satisfiable by jms/di-extra-bundle dev-master.
<?php
class Sedlmayr {
private $_gender;
private $_name;
public function __construct()
{
@catchamonkey
catchamonkey / gitproblem
Created March 26, 2012 11:05
A git problem
A git problem.
I Created and checked out a new branch called 'feature'
I created files, worked on them, committed changes and pushed upstream.
I Carried on working on the new files, made further changes, then thought these additional changes should belong in a different feature.
While on the 'feature' branch I ran git checkout -b sub_feature master
Oops, I really should have just created this branch based on my current 'feature' branch as it's a sub feature and therefore dependent on it.
So I then ran another wrong command, git reset . to reset my tree back to the known state, unfortunately that was of course the state of master, not my actual 'feature' like I wanted.
So I thought, hey I'll just checkout the 'feature' again, then start from there. But of course it won't let me as I have untracked files that already exist in the branch I want to checkout.
@catchamonkey
catchamonkey / git_push_current_branch
Created February 15, 2012 08:31
git push to current branch
git push origin `git rev-parse --abbrev-ref HEAD`
@catchamonkey
catchamonkey / New PC Build.md
Created November 17, 2011 19:03
New PC Build

Cooler Master Elite 430 Case
Intel Core i5 2500K Processor Overclocked to 4.4GHz
Corsair A70 Ultra Quiet CPU Cooler
Asus P8Z68-V LE Motherboard
8GB PC3-10666 1333MHz DDR3 Memory
Chillblast NVIDIA GeForce GTX 560Ti 1024MB Graphics Card
1000GB 7200RPM HDD
Corsair TX 750W PSU
300Mbps 802.11n Wireless PCI Adaptor
OS Dual Boot;

@catchamonkey
catchamonkey / stdInMailer.php
Created November 9, 2011 12:28
Mail your Errors during development without Nagios/Ossec
<?php
// during development you can simply have all Error mentions in your logs (presumably you are logging properly?) mailed to you.
// in production you may be using OSSEC/Nagios etc, but this is a quick win for dev.
// to run, you would do something like
// tail -f /var/log/messages |grep Error | php /home/sites/poc/stdInMailer.php
$fp = fopen("php://stdin","r");