Skip to content

Instantly share code, notes, and snippets.

View mackensen's full-sized avatar

Charles Fulton mackensen

View GitHub Profile
@mackensen
mackensen / default.php
Created October 13, 2014 14:32
Moodle CodeSniffer error output
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@mackensen
mackensen / gulpfile.js
Created October 21, 2014 15:35
This is an example gulpfile for managing a WordPress theme with a custom (non-LESS) CSS stylesheet. It includes tools for bumping the version and updating the version references.
// List of modules used.
var gulp = require('gulp'),
bump = require('gulp-bump'), // Generates new version.
argv = require('yargs')
.default('release', 'patch')
.argv, // CLI parser.
fs = require('fs'), // Used by bump.
semver = require('semver'), // Used by bump.
git = require('gulp-git'), // Git wrapper.
jshint = require('gulp-jshint'), // Lints JS.
@mackensen
mackensen / page.tpl.php
Created October 28, 2014 14:46
This is a Drupal template file.
<?php
/**
* @file
* Output for main HTML page content.
*/
if ($tabs = render($tabs)):
?>
<div class="tabs">
<?php
<?php
/**
* @file
* homebox.tpl.php
* Default layout for homebox.
*/
?>
<?php global $user; ?>
{
"translatorID": "3f4f0a1c-f542-4b44-8824-40ee1f921373",
"label": "Trains News Wire",
"creator": "Charles Fulton",
"target": "https?://trn.trains.com/news/news-wire/[0-9]+",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
@mackensen
mackensen / .gitlab-ci.yml
Created November 14, 2016 15:49
Mocked up gitlab config for running selenium in a linked container
# Custom docker image which exposes 8080
image: lafayette/hoth:5.5
services:
- selenium/standalone-chrome:latest
before_script:
# Use 0.0.0.0 instead of localhost to allow external connections
- php -S 0.0.0.0:8080 -t ../ &> /dev/null &
@mackensen
mackensen / allactivecourses.sql
Last active August 14, 2017 13:49
All active Moodle courses in a given term
SELECT c.fullname,
c.shortname,
c.idnumber
FROM prefix_course c
WHERE EXISTS
(SELECT cc.id
FROM prefix_course_categories cc
WHERE cc.id=c.category
AND cc.parent=:term
LIMIT 1)
@mackensen
mackensen / allcoursesbydepartment.sql
Created August 14, 2017 13:54
This report groups all Moodle courses for a given term by department with activity status.
SELECT department,
COUNT(*) AS courses,
SUM(CASE
WHEN active=1 THEN 1
ELSE 0
END) active,
SUM(CASE
WHEN active=0 THEN 1
ELSE 0
END) inactive
@mackensen
mackensen / allcoursesterm.sql
Created August 14, 2017 14:01
This report lists all courses for a given term with activity status.
SELECT c.fullname,
c.shortname,
c.idnumber,
CASE
WHEN EXISTS
(SELECT id
FROM prefix_logstore_standard_log lsl
WHERE lsl.courseid=c.id
AND (lsl.crud='c'
OR lsl.crud='u')