Skip to content

Instantly share code, notes, and snippets.

@mkolb
mkolb / engage-grading-resources.html
Created April 20, 2017 14:52
Engage Grading Resources
<ul>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.assignments.creating_and_using_rubrics_for_assignments.html">Rubrics</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.grades.how_course_grades_are_calculated.html">How grades are calculated</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.grades.aggregation_natural.html">Natural aggregation method</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.grades.grade_submission_tracker.html">Grade submission tracker</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.forums.grading_forums.html">Forum grade book</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/faculty.forums.rubrics_for_forums.html">Rubrics for forums</a></li>
<li><a href="https://engagesupport.s3.amazonaws.com/current/studentfaculty.assignments.vericite_plagiarism_prevention.html">VeriCite</a></li>
</ul>
@mkolb
mkolb / course-size
Created April 30, 2015 21:49
All moodle courses, ordered by enrollment size
SELECT course.fullname AS course, COUNT(course.id) AS students FROM mdl_role_assignments AS asg
JOIN mdl_context AS context ON asg.contextid = context.id AND context.contextlevel = 50 JOIN mdl_user AS u ON u.id = asg.userid JOIN mdl_course AS course ON context.instanceid = course.id WHERE asg.roleid = 5 GROUP BY course.id ORDER BY COUNT(course.id) DESC;
Unstaged changes:
Modified mod/quiz/edit.php
diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php
index 884fa23..ce331bf 100644
--- a/mod/quiz/edit.php
+++ b/mod/quiz/edit.php
@@ -84,15 +84,7 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
question_bank::get_qtype('random')->get_available_questions_from_category(
$category->id, $recurse);
@mkolb
mkolb / gist:6423899
Created September 3, 2013 13:26
michigan crash data
field: acc_crsh_id [desc: Crash Identifier]
field: acc_date_val [desc: Date]
field: acc_day_of_week [desc: Day of the Week]
field: acc_milt_time [desc: Military Time]
field: acc_fatl_crsh_ind [desc: Fatal Crash ]
field: acc_injy_crsh_ind [desc: Injury Crash]
field: acc_prop_damg_crsh_ind [desc: Property Damage Crash]
field: acc_num_fatl [desc: Number of Fatalities in UNit]
field: acc_num_injy [desc: Number of Injuries in Unit]
field: acc_num_injy_a [desc: description unavailable]
# percent posts and total for instructors in a course
select ROUND(100.0 * (SUM(CASE WHEN r.shortname IN ('teacher', 'editingteacher') THEN 1 ELSE 0 END) / (1.0 * COUNT(p.id))), 1) as percent_total, count (p.id) as total
from mdl_user u
left join mdl_role_assignments a on a.userid=u.id
left join mdl_role r on r.id=a.roleid
left join mdl_context x on x.id=a.contextid AND x.contextlevel=50
left join mdl_course c on c.id=x.instanceid
left join mdl_forum_discussions d on d.course=c.id
left join mdl_forum_posts p on p.discussion=d.id
@mkolb
mkolb / gist:4113580
Created November 19, 2012 20:13
ubuntu crap i can't remember
do-release-upgrade -d -f DistUpgradeViewNonInteractive
@mkolb
mkolb / navigationlib.php
Created October 25, 2012 13:54
blog + groups fix
if (has_capability('moodle/course:viewparticipants', $this->page->context)) {
$participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CONTAINER, get_string('participants'), 'participants');
$currentgroup = groups_get_course_group($course, true);
if ($course->id == SITEID) {
$blogparams = array('courseid' => '');
} else if ($course->id && !$currentgroup) {
$blogparams = array('courseid' => clean_param($course->id, PARAM_INT));
} else {
$blogparams = array('group' => clean_param($currentgroup, PARAM_INT));
}
@mkolb
mkolb / navigationlib.php
Created October 25, 2012 13:49
groups + blogs fix
if (has_capability('moodle/course:viewparticipants', $this->page->context)) {
$participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CONTAINER, get_string('participants'), 'participants');
$currentgroup = groups_get_course_group($course, true);
if ($course->id == SITEID) {
$blogparams = array('courseid' => '');
} else if ($course->id && !$currentgroup) {
$blogparams = array('courseid' => clean_param($course->id, PARAM_INT));
} else {
$blogparams = array('group' => clean_param($currentgroup, PARAM_INT));
}
@mkolb
mkolb / gist:3143416
Created July 19, 2012 12:08
mike's queries
select distinct mc.shortname as course_id, mr.shortname as role, mu.username as loginname, mcon.contextlevel
from mdl_user_enrolments mue
join mdl_enrol me on mue.enrolid=me.id
join mdl_user mu on mue.userid=mu.id
join mdl_course mc on me.courseid=mc.id
join mdl_role_assignments mra on mu.id=mra.userid
join mdl_role mr on mra.roleid=mr.id
join mdl_context mcon on mcon.instanceid=mc.id where mr.shortname='student' order by mc.shortname and mu.username=’craigl’;
-- yields
@mkolb
mkolb / gist:3054048
Created July 5, 2012 14:32
changing permissions/ownership in postgres
for tbl in`psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" YOUR_DB`; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done
for tbl in`psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" YOUR_DB`; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done
for tbl in`psql -qAt -c "select sequence_name from information_schema.sequences where sequence_schema = 'public';" YOUR_DB`; do psql -c "alter table $tbl owner to NEW_OWNER" YOUR_DB ; done