Skip to content

Instantly share code, notes, and snippets.

View hanleybrand's full-sized avatar

Peter Hanley hanleybrand

View GitHub Profile
@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
@hanleybrand
hanleybrand / bower.json
Created February 4, 2015 16:20
sample angular 1.3 bower.json file
{
"name": "bbtools-ng",
"version": "0.0.0",
"dependencies": {
"angular": "^1.3.0",
"json3": "^3.3.0",
"es5-shim": "^4.0.0",
"bootstrap-sass-official": "^3.2.0",
"angular-animate": "^1.3.0",
"angular-aria": "^1.3.0",
@hanleybrand
hanleybrand / metadata_in_table.html
Created March 17, 2015 13:47
metadata crawl examples - for future art metadata scraper idea source:
<a href="http://www.comicartfans.com/gallerypiece.asp?piece=1016448"SOURCE</a>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tbody><tr>
<td width="40%" valign="top">
<h2 class="head">Artwork Details</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tbody><tr>
<td width="1%" style="height:18px; text-align:right" nowrap=""><b>Title:</b></td>
<td><b>VEBER Les maisons sont des visages 1899</b></td>
@hanleybrand
hanleybrand / shell_plus output.md
Last active August 29, 2015 14:17
shell plus output of an issue with rooibos.access.functions
from django.contrib.auth.models import AnonymousUser
from rooibos.storage.models import Storage
from rooibos.access.functions import filter_by_access
u = User.objects.get(pk=1)
au = AnonymousUser()
q = Storage
qo = Storage.objects.all()