Skip to content

Instantly share code, notes, and snippets.

View catchamonkey's full-sized avatar
👨‍💻

Chris Sedlmayr catchamonkey

👨‍💻
View GitHub Profile
/* Profile Collection */
{
"_id" : ObjectId("54aeab798c4158100f8b4567"),
"name" : "A Profile",
"createdAt" : ISODate("2015-01-08T16:08:25.000Z"),
"addresses" : {
"0" : {
"name" : "Address 1"
}
}
@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.
@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:
<?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`