Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Fulton mackensen

View GitHub Profile
@mackensen
mackensen / allcoursesterm.sql
Created Aug 14, 2017
This report lists all courses for a given term with activity status.
View allcoursesterm.sql
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')
@mackensen
mackensen / allcoursesbydepartment.sql
Created Aug 14, 2017
This report groups all Moodle courses for a given term by department with activity status.
View allcoursesbydepartment.sql
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 / allactivecourses.sql
Last active Aug 14, 2017
All active Moodle courses in a given term
View allactivecourses.sql
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 / .gitlab-ci.yml
Created Nov 14, 2016
Mocked up gitlab config for running selenium in a linked container
View .gitlab-ci.yml
# 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 &
View Trains News Wire.js
{
"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,
View homebox.tpl.php
<?php
/**
* @file
* homebox.tpl.php
* Default layout for homebox.
*/
?>
<?php global $user; ?>
@mackensen
mackensen / page.tpl.php
Created Oct 28, 2014
This is a Drupal template file.
View page.tpl.php
<?php
/**
* @file
* Output for main HTML page content.
*/
if ($tabs = render($tabs)):
?>
<div class="tabs">
<?php
@mackensen
mackensen / gulpfile.js
Created Oct 21, 2014
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.
View gulpfile.js
// 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 / default.php
Created Oct 13, 2014
Moodle CodeSniffer error output
View default.php
<?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