Skip to content

Instantly share code, notes, and snippets.

View emyb's full-sized avatar

Donald Barrett emyb

View GitHub Profile
<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.megabus.com.au/MWS" targetNamespace="http://www.megabus.com.au/MWS">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.megabus.com.au/MWS">
<complexType name="AdditionalAttribute">
<sequence>
<element name="DisplayOrder" type="s:int"/>
<element name="AttributeName" type="s:string"/>
<element name="DataType" type="s:int"/>
<element name="StringLength" type="s:int"/>
@emyb
emyb / azure_mariadb_hacks.patch
Created June 28, 2022 21:53
A patch for mariadb to be able to work on moodles that have an azure one.
diff --git a/lib/dml/mariadb_native_moodle_database.php b/lib/dml/mariadb_native_moodle_database.php
old mode 100644
new mode 100755
index 358a493647..c6f21e736e
--- a/lib/dml/mariadb_native_moodle_database.php
+++ b/lib/dml/mariadb_native_moodle_database.php
@@ -79,13 +79,10 @@ class mariadb_native_moodle_database extends mysqli_native_moodle_database {
* @return array Array containing 'description' and 'version' info
*/
public function get_server_info() {
<?php
// A simple file to do some php stuff then do some html stuff.
// The "array $records = []" means that the parameter $records has to be of data type array, and if there is no parameter
// passed, $records will default to an empty array. This will reduce the amount of error checking in the function. This
// is called an optional parameter. Order of optional and required parameters are important. Read some php docs about it.
// A required parameter would just be function stuff($parameter1, $parameter2) {}.
function div_the_things(array $records = []) {
$returnString = "<div class='outer-div'>";
for ($i = 0; $i < count($records); $i++) {
<?php
// A simple file to do some php stuff then do some html stuff.
// Make connection to the database, query the database, get the results.
$records = [
['id' => 1, 'firstname' => 'Harry', 'lastname' => 'Potter'],
['id' => 2, 'firstname' => 'Hermione', 'lastname' => 'Granger']
['id' => 3, 'firstname' => 'Ronald', 'lastname' => 'Weasly'],
['id' => 3, 'firstname' => 'Tom', 'lastname' => 'Riddle']
];
@emyb
emyb / oauth2_moodle_user_map_array.php
Last active May 21, 2020 21:01
Code to support oauth2 properties that are an array of things.
<?php
$map = [
'otherMails-0' => 'email'
];
$userinfo = json_decode('{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(*)/$entity",
"otherMails": [
"0@",
"1",
"2"
@emyb
emyb / oauth2_moodle_user_map_array.php
Created May 21, 2020 21:01
Code to support oauth2 properties that are an array of things.
<?php
$map = [
'otherMails-0' => 'email'
];
$userinfo = json_decode('{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(*)/$entity",
"otherMails": [
"0@",
"1",
"2"