Skip to content

Instantly share code, notes, and snippets.

View danpoltawski's full-sized avatar

Dan Poltawski danpoltawski

View GitHub Profile
git push --mirror github
Counting objects: 32685, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13941/13941), done.
Writing objects: 100% (29061/29061), 13.66 MiB | 345 KiB/s, done.
Total 29061 (delta 19317), reused 21379 (delta 14889)
To [email protected]:danpoltawski/moodle.git
- [deleted] MDL-19549
- [deleted] MDL-19549-22
- [deleted] MDL-22504_drag_and_drop_upload
@danpoltawski
danpoltawski / gist:3223376
Created August 1, 2012 03:26
enrol all users to a course
<?php
define('CLI_SCRIPT', true);
require_once('config.php');
require_once($CFG->dirroot.'/user/lib.php');
define('COURSEID', 2);
define('STUDENTROLEID', 5);
$enrol = enrol_get_plugin('manual');
$enrolinstances = enrol_get_instances(COURSEID, true);
diff --git a/admin/index.php b/admin/index.php
index d75e364..5e95598 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -273,6 +273,10 @@ if ($version > $CFG->version) { // upgrade
die();
}
}
+ if (file_exists("$CFG->dirroot/githash.php")) {
+ echo "Version for bug report: $githash";
@danpoltawski
danpoltawski / moveallforumposts.php
Created December 7, 2012 03:19
Allows bulk move of forum posts from one discussion to another
<?php
define('CLI_SCRIPT', true);
require_once('config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/rsslib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->dirroot.'/mod/forum/rsslib.php');
list($options, $unrecognized) = cli_get_params(
@block_rss
Feature: Add blocks
In order to add more functionality to pages
As a teacher
I need to add rss feeds
@javascript
Scenario: Add and configure an RSS block
Given the following "courses" exists:
| fullname | shortname | format |
@danpoltawski
danpoltawski / gist:5081032
Created March 4, 2013 09:19
sql query including bank holidays
SELECT t.trip_id, s.departure_time, t.trip_headsign
FROM gtfs_stop_times s
JOIN gtfs_trips t ON s.trip_id = t.trip_id
WHERE s.stop_id = 99005 AND s.departure_time >= "17:10:53"
AND s.danp_last_stop IS NULL
AND t.service_id IN (SELECT c.service_id FROM gtfs_calendar c
LEFT JOIN gtfs_calendar_dates d ON d.service_id = c.service_id AND d.date = "20130304"
WHERE c.start_date <= "20130304" AND c.end_date >= "20130304" AND c.monday = 1 AND d.service_id IS NULL
UNION SELECT service_id FROM gtfs_calendar_dates d WHERE d.date = "20130304" AND d.exception_type = 1)
ORDER BY s.departure_time LIMIT 2;
@danpoltawski
danpoltawski / phpunitshellsnipper.sh
Last active December 15, 2015 16:59
bash function for notifying me of phpunit failures
function phpunit() {
vendor/bin/phpunit $@
if [[ $? == 0 ]]; then
finished "phpunit OK"
else
finished "phpunit FAILED"
fi
}
@danpoltawski
danpoltawski / gist:5571541
Created May 13, 2013 21:07
failed behat tests frm 2a7a5cfa4c9
(::) failed steps (::)
01. Xpath matching locator "//div[@class='region-content']/descendant::table/descendant::tr[4]" not found.
In step `And "//div[@class='region-content']/descendant::table/descendant::tr[4]" "xpath_element" should exists'. # behat_general::should_exists()
From scenario `Wiki page edition history changes list'. # /Users/danp/git/integration/mod/wiki/tests/behat/page_history.feature:8
Of feature `A history of each wiki page is available'. # /Users/danp/git/integration/mod/wiki/tests/behat/page_history.feature
02. Css matching locator ".region-content .generaltable td span" not found.
In step `And I hover ".region-content .generaltable td span" "css_element"'. # behat_general::i_hover()
From scenario `Basic contents assertions'. # /Users/danp/git/in
@danpoltawski
danpoltawski / gist:5579657
Created May 14, 2013 21:22
mink extension behat
$CFG->behat_config = array(
'Mac-Firefox' => array(
'extensions' => array(
'Behat\MinkExtension\Extension' => array(
'selenium2' => array(
default:
paths:
features: /Users/danp/git/integration/lib/behat/features
bootstrap: /Users/danp/git/integration/lib/behat/features/bootstrap
context:
class: behat_init_context
extensions:
Behat\MinkExtension\Extension:
base_url: 'http://localhost:8000'
goutte: null