Skip to content

Instantly share code, notes, and snippets.

View hanleybrand's full-sized avatar

Peter Hanley hanleybrand

View GitHub Profile
@hanleybrand
hanleybrand / gist:ee260b53dfb404f5055a
Created July 2, 2014 16:51
traceback for stackoverflow question
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/signup/
Django Version: 1.6.5
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
@hanleybrand
hanleybrand / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hanleybrand
hanleybrand / min max dates on bb learn activity accumulator tables.sql
Created December 15, 2014 15:05
Blackboard Learn Activity Accumulator - min/max dates (bb60 schema)
-- checks the min/max dates on your activity accumulator tables
SELECT
MIN(prod.TIMESTAMP)as 'AA min date bb60'
, MAX(prod.TIMESTAMP) as 'AA max date bb60'
,(SELECT MIN(TIMESTAMP) FROM bb_bb60_stats.dbo.ACTIVITY_ACCUMULATOR) as 'AA min date bb60_stats'
,(SELECT MAX(TIMESTAMP) FROM bb_bb60_stats.dbo.ACTIVITY_ACCUMULATOR) as 'AA min date bb60_stats'
FROM bb_bb60.dbo.ACTIVITY_ACCUMULATOR prod;
@hanleybrand
hanleybrand / activity_accumulator_by_course_pk1.sql
Last active August 29, 2015 14:11
Blackboard Learn WIP sql query - raw course content consumption data (ignores folder views)
-- 2 unioned ACTIVITY_ACCUMULATOR queries, 1st [bb_bb60_stats] then [bb_bb60]
--DECLARE @Term varchar
DECLARE @TermName nvarchar(100)
DECLARE @CoursePK1 INT
DECLARE @StatsMax datetime
DECLARE @TimeMin datetime
DECLARE @TimeMax datetime
SET @TermName = 'Fall 2014' -- term name
@hanleybrand
hanleybrand / last academically relevant activity by term.sql
Created December 17, 2014 21:58
Blackboard Learn WIP sql query - last academically relevant activity by term for set of students
use bb_bb60_stats
-- TODO - can this be re-written (e.g. against uses first) so that
-- -- students with no data will still get a listing
-- -- only the most recent item is reported (most recent of every type of activity is currently reported
-- TODO parameterize studentID list
--DECLARE @IDlist TABLE(studID nvarchar(10) NOT NULL)
--INSERT INTO @IDlist
-- SELECT
@hanleybrand
hanleybrand / stored procedure names.sql
Created December 17, 2014 22:08
List of Blackboard Learn stored procedures
select 'bb_bb60.db' as db,name
from bb_bb60.sys.procedures
union
select 'bb_bb60_stats.db' as db, name
from bb_bb60_stats.sys.procedures
order by name
@hanleybrand
hanleybrand / osx_pdf_join.sh
Last active August 29, 2015 14:13 — forked from anthonywu/osx_pdf_join.sh
Mac OS X bash alias for concatenating pdf files - usage: pdf_join output_file.pdf [list of files]
function pdf_join {
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
read -p "Name of output file > " output_file && "$join_py" -o $output_file $@ && open $output_file
}
@hanleybrand
hanleybrand / bb learn reset portal prefs.sql
Last active August 29, 2015 14:13
Blackboard Learn - fix weird portal problems for single user (t-sql)
Declare @Users_PK1 INT
Declare @User_ID varchar(50)
Set @User_ID = 'username' -- User name here, e.g. bobsmith
Select @Users_PK1 = PK1 from users where user_id = @User_ID
--Delete Module Preferences from Users
DELETE from PORTAL_EXTRA_INFO where portal_viewer_pk1 in (
Select pk1 from PORTAL_VIEWER where USERS_PK1 = @Users_PK1
/*
Pinal Dave's Basics of Joins (T-SQL)
translated to @table from #table, no adventureworks, comment column for ease of comparison
http://blog.sqlauthority.com/2009/04/13/sql-server-introduction-to-joins-basic-of-joins/
*/
declare @table1 TABLE (ID INT, Value VARCHAR(10))
INSERT INTO @table1 (ID, Value)
SELECT 1,'First'
UNION ALL
@hanleybrand
hanleybrand / grade_by_rubric_report.sql
Last active August 29, 2015 14:14
Report of Grades for single rubric in single course (T-SQL) - find/replace <rubric_pk1> to use
--step 3 user recieves report for selected rubric:
-- rubric_pks for a course can be gotten via:
-- select r.pk1 as rubric_pk1, r.title
-- from rubric r where r.course_pk1 = [course_pk1]
-- sample output:
-- rubric_pk1 title
-- 2515 'Individual Assignment'
-- NOTE THIS QUERY BRANCHES BASED ON WHETHER THE RUBRIC IS
-- ASSOCIATED WITH AN INDIVIDUAL OR GROUP ASSIGNMENT AND THE