Skip to content

Instantly share code, notes, and snippets.

rootl

Block or report user

Report or block rootl

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
@rootl
rootl / Pressbooks_Export_Example2pdf.css
Last active Apr 20, 2017
Pressbooks PDF Export Custom CSS Example 2 (book site reference: "milnepublishing.geneseo.edu/concise-introduction-to-logic")
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
*/
/*
@rootl
rootl / Pressbooks_Export_Example1pdf.css
Created Apr 20, 2017
Pressbooks PDF Export Custom CSS Example 1 (book site reference: "the-evolution-of-our-tribe-hominini")
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
*/
/*
@rootl
rootl / WP-Query-Download-Type-SUM-AVG-Day-Month
Last active Mar 30, 2016
MySQL WordPress sanitized Query for SUM, AVG of Downloads by Download Type. NOTES: Additional Types (ie HTML or Source Code) can be added. Query qepends on Download Monitor and Posts2Posts plugin for other WP users' ease of adding files and assigning them to posts. Grouping won't work here so I use CASE. Future plans: 1) Remove excess JOINS on t…
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
@rootl
rootl / AVG-MED-MIN-MAX-MONTH-YEAR
Last active Mar 30, 2016
Query for SQL 2012 : Percentile_DISC function for median; sum, min, max, avg queries grouped by month and year. I will also post a version for sql versions lower than 2012 that cannot use percentile. Notes: 1) "DailyDiff" is a computed column using "PMCounts-AMCounts/2" to obtain the GateCount Daily Difference. 2) DB isn't partitioned so I had t…
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)
@rootl
rootl / LibraryHoursExceptionsAdmin.sql
Last active Mar 30, 2016
MySQL query to join date ranges with exceptions. Used for Library Hours Webservice with PHP based admin panel. The user will see a date range row listing library hours during that date range, along with any exceptions such as closings, holiday hours, extended hours.
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,
@rootl
rootl / HeadCountsMilneFraser.sql
Last active Mar 30, 2016
SQL 2012 Milne and Fraser Daily and Hourly Totals. Milne 3 Floors totals caclulated, totalled, joined and added to corresponding Fraser totals.
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,
@rootl
rootl / 0_reuse_code.js
Last active Sep 16, 2015
Here are some things you can do with Gists in GistBox.
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
You can’t perform that action at this time.