Instantly share code, notes, and snippets.

View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View HeadCountsMilneFraser.sql
CREATE TABLE HeadCountsMilne
(
ID int identity(1,1) not null primary key,
Date datetime,
Hour varchar(50),
FirstFloor int,
MainFloor int,
ThirdFloor int,
TotalMilneThreeFloors int,
View LibraryHoursExceptionsAdmin.sql
CREATE TABLE IF NOT EXISTS `dayrangehours` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`StartDate` date NOT NULL,
`EndDate` date NOT NULL,
`MonStartT` time DEFAULT NULL,
`MonEndT` time DEFAULT NULL,
`TuesStartT` time DEFAULT NULL,
`TuesEndT` time DEFAULT NULL,
`WedStartT` time DEFAULT NULL,
`WedEndT` time DEFAULT NULL,
View AVG-MED-MIN-MAX-MONTH-YEAR
SELECT
Year([Date]) GC_Year,
Month([Date]) GC_Month,
DATENAME(month,[Date]) Month_Name,
SUM(DailyDiff) AS GateCounts_MonthlyTotal,
MIN(DailyDiff) AS GateCounts_MIN,
MAX(DailyDiff) AS GateCounts_MAX,
AVG(DailyDiff) AS GateCounts_AVG,
GateCounts_MED=MAX(Median)
View WP-Query-Download-Type-SUM-AVG-Day-Month
global $wpdb;
$result = $wpdb->get_results("
SELECT p.post_title AS 'Title',
SUM(CASE WHEN t.name = 'PDF' THEN m.meta_value ELSE NULL END) as 'PDF',
SUM(CASE WHEN t.name = 'EPUB' THEN m.meta_value ELSE NULL END) as 'EPUB',
SUM(m.meta_value) AS 'Totals',
round(AVG((m.meta_value)/180)) as 'DailyAvg',
round(AVG((m.meta_value)/30)) as 'MonthlyAvg',
r.p2p_from AS 'From'
FROM
View Pressbooks_Export_Example1pdf.css
/*
Theme Name: Luther PDF
Theme URI: http://pressbooks.com/
Description: Named after Martin Luther, this is a traditional book theme, good for novels, and text-heavy non-fiction. An earlier version of this theme was commissioned by Fortress Press / Augsburg Fortress.
Author: Pressbooks (Book Oven Inc.)
Author URI: http://pressbooks.com
Copyright 2011-2015 Book Oven Inc. (Pressbooks.com) code@pressbooks.com
Version: 1.4
*/
/*
View Pressbooks_Export_Example2pdf.css
/*
Theme Name: Luther PDF
Theme URI: http://pressbooks.com/
Description: Named after Martin Luther, this is a traditional book theme, good for novels, and text-heavy non-fiction. An earlier version of this theme was commissioned by Fortress Press / Augsburg Fortress.
Author: Pressbooks (Book Oven Inc.)
Author URI: http://pressbooks.com
Copyright 2011-2015 Book Oven Inc. (Pressbooks.com) code@pressbooks.com
Version: 1.4
*/
/*