Skip to content

Instantly share code, notes, and snippets.

Richard Gaunt rbg246

  • Melbourne, Australia
Block or report user

Report or block rbg246

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rbg246
rbg246 / TransformerAbstract.php
Created Jul 24, 2018
Abstract Transformer class for PHP
View TransformerAbstract.php
<?php
/**
* Class TransformerAbstract
* contains functions for validating fields
*
* @package Drupal\streamtime
*/
abstract class TransformerAbstract {
@rbg246
rbg246 / check-for-google-analytics-id.js
Created Nov 30, 2015
Prints a list of universal analytic ids found on a site
View check-for-google-analytics-id.js
function checkAnalytics () {
var ids = ga.getAll();
var len = ids.length;
console.log('Universal Analytics');
console.log('ids', ids);
console.log('=======================================================');
console.log('Number of Universal Analytics IDs found : ' + ids.length);
console.log('=======================================================');
console.log('Universal Analytics IDs');
console.log('=======================================================');
View template.php
<?php
/**
* This snippet adds extra classes to Drupal
* menu leafs (li tags) and menu itself (ul tags).
*/
/**
* Since the standart preprocess function for menu tree, which is
* template_preprocess_menu_tree, located in includes/menu.inc,
@rbg246
rbg246 / gist:a2a9f0e3f045e911c283
Created Jun 10, 2015
Universal Analytics - Check IDs loaded on webpage
View gist:a2a9f0e3f045e911c283
function checkAnalytics () {
var ids = ga.getAll();
var len = ids.length;
console.log('Universal Analytics');
console.log('ids', ids);
console.log('=======================================================');
console.log('Number of Universal Analytics IDs found : ' + ids.length);
console.log('=======================================================');
console.log('Universal Analytics IDs');
console.log('=======================================================');
View countCSSRules.js
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@rbg246
rbg246 / config.js
Created Jun 1, 2015
CasperJS Test File - iterating through a Data Object specifying multiple viewports for each page
View config.js
module.exports = {
clientScripts : [
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/lodash/index.js'
],
viewportSize : {
width: 1600,
height: 1200
},
timeout : 50000,
@rbg246
rbg246 / gist:5af38b48afb45bd77fa8
Last active Aug 29, 2015
Virtual Box - Setup, linking Virtual box with your computer's localhost and vhosts
View gist:5af38b48afb45bd77fa8
Reference: http://stackoverflow.com/questions/1261975/addressing-localhost-from-a-virtualbox-virtual-machine
In Virtual Box - running Windows:
You can reach your localhost via:
http://10.0.2.2
If you need to link to vhosts on your localhost though you need to update the virtual box's hosts file
@rbg246
rbg246 / page-tests
Created Apr 29, 2015
Example of Mocha and SpookyJS iterating through a series of pages, running example tests
View page-tests
function pageParser() {
return {
url : window.location.href,
title : $('title').text(),
description : $('meta[name="description"]').attr('content')
};
}
View spookymultiple.js
var Spooky, config, i, run_spooky, scraping, spooky, spooky_is_ready;
Spooky = require('spooky');
config = {
child: {
port: 8081
}
};
You can’t perform that action at this time.