Skip to content

Instantly share code, notes, and snippets.

@chrisshennan
chrisshennan / Cas\Behat\Resources\services.yml
Last active February 8, 2023 16:12
Test an email has been sent using behat and the Symfony web profiler
services:
mink.context:
class: 'Behat\MinkExtension\Context\MinkContext'
calls:
- [setMink, ['@__behat__.mink']]
tags:
- { name: fob.context_service }
dashboard.features_context.profiler_context:
class: DashboardBundle\Features\Context\ProfilerContext
@chrisshennan
chrisshennan / track-outbound-links.js
Last active October 18, 2018 12:01
How to track outbound links
@chrisshennan
chrisshennan / ip-updater.php
Last active October 7, 2015 08:19
Ip Updater
<?php
$ipFile = '/tmp/ip.txt';
$username = 'user';
$password = 'pass';
$hostname = 'test.test.com';
$ip = '';
$ip = @file_get_contents('http://wtfismyip.com/text');
@chrisshennan
chrisshennan / check-database-settings.sh
Last active October 1, 2015 19:41
Installing & Configuring Symfony2
# Test the database connection using a simple query (no database tables required)
cd /data/projects/insidethe.agency
php app/console doctrine:query:sql "SELECT NOW()";
@chrisshennan
chrisshennan / localtunnel-me-server-alias.conf
Created September 1, 2015 20:13
Sample Apache2 Configuration for Localtunnel.me
<VirtualHost *:80>
DocumentRoot /data/sites/i/insidetheagency.chris.laptop.internal/web
ServerName insidetheagency.chris.laptop.internal
ServerAlias insidetheagencydev.localtunnel.me
ErrorLog log/insidetheagency.chris.laptop.internal-error.log
CustomLog log/insidetheagency.chris.laptop.internal-access.log combined
<Directory /data/sites/i/insidetheagency.chris.laptop.internal/web>
@chrisshennan
chrisshennan / useful-regular-expressions.php
Created August 31, 2015 11:04
A list of useful regular expressions I commonly use
<?php
// Check if link absolute starts with (http, https or //)
preg_match('/^(http(s)?:)?\/\//', $link, $matches);
@chrisshennan
chrisshennan / title-generation-with-if-statement.php
Last active August 27, 2015 11:17
Generating a title with or without a tag
<?php
function generateLabelContent($includeHref = true) {
if($includeHref) {
$content = '<a href="http://www.google.co.uk">Google</a>';
} else {
$content = "Google";
}
@chrisshennan
chrisshennan / disqus-comments-by-id.js
Last active August 29, 2015 14:27
Notify authors of new disqus comments.
$(function() {
window.disqus_config = function() {
this.callbacks.onNewComment = [function(comment) {
// Comment parameter has 2 values
// id = The id of the disqus comment
// text = the comment message
data = comment;
// Add in our article ID parameter so we can locate the article by ID