Skip to content

Instantly share code, notes, and snippets.

View marinaglancy's full-sized avatar

Marina Glancy marinaglancy

View GitHub Profile
@marinaglancy
marinaglancy / userbadges.php
Created October 25, 2022 08:43
User badges datasource
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@marinaglancy
marinaglancy / testselect.php
Last active April 24, 2019 09:32
Test the select and course elements
<?php
require_once(__DIR__ . '/config.php');
require_once($CFG->libdir.'/formslib.php');
require_login();
$PAGE->set_url(new moodle_url('/testselect.php'));
$PAGE->set_context(context_system::instance());
class testform extends moodleform {
public function definition()
{
@marinaglancy
marinaglancy / testform.php
Last active April 24, 2019 10:12
Test for the forms id conflict bug
<?php
require_once(__DIR__ . '/config.php');
require_once($CFG->libdir.'/formslib.php');
require_login();
$PAGE->set_url(new moodle_url('/testform.php'));
$PAGE->set_context(context_system::instance());
class testform extends moodleform {
@marinaglancy
marinaglancy / .gitconfig
Last active March 13, 2019 08:06
Git alias config for checking all submodules
[alias]
is-clean = !git status --ignore-submodules|grep -q 'working tree clean'
is-master = !git status --ignore-submodules|head -1|grep -q 'On branch master'
is-up-to-date-with-master = !git status --ignore-submodules|head -2|tail -1|grep -q 'Your branch is up to date with'
is-behind = !git status --ignore-submodules|head -2|grep -q 'Your branch is behind'
show-header = !bash -c 'echo && echo "--- $0 ---"' $1
status-dirty = !bash -c 'git is-clean && git is-master && git is-up-to-date-with-master || (git show-header $0 && git status --ignore-submodules)' $1
pull-if-behind = !bash -c 'git fetch origin --prune && git is-clean && git is-master && git is-behind && git show-header $0 && git pull' $1
#--------- Fetch origin on all submodules and main branch
f = !git submodule foreach -q 'git fetch origin --prune' && git fetch origin --prune
@marinaglancy
marinaglancy / genesis_public_key
Last active March 6, 2018 05:20
genesis_public_key
045be00d5cb85b76b756c5b442cd45ba3bd75a859872aec9b9f6d6f4359827a2db4d3117148de80fdadd6173039cf1f98c17df3518e571cdbc1fcd75aa482cf4c0;romanornr
@marinaglancy
marinaglancy / strace.txt
Created October 24, 2017 06:45
xmlrpc_encode_request strace
execve("/usr/bin/php", ["php", "-r", "echo xmlrpc_encode_request('func', 'text', []);"], [/* 63 vars */]) = 0
brk(0) = 0x55833b2b1000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f22f06b6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=119754, ...}) = 0
mmap(NULL, 119754, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f22f0698000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
@marinaglancy
marinaglancy / envreport.htm
Created May 20, 2016 01:19
Example of environment report
<h2>Server checks</h2><table class="admintable environmenttable generaltable" id="serverstatus">
<thead>
<tr>
<th class="header c0 centeralign name" style="" scope="col">Name</th>
<th class="header c1 centeralign info" style="" scope="col">Information</th>
<th class="header c2 leftalign report" style="" scope="col">Report</th>
<th class="header c3 leftalign plugin" style="" scope="col">Plugin</th>
<th class="header c4 lastcol centeralign status" style="" scope="col">Status</th>
</tr>
</thead>
@marinaglancy
marinaglancy / testforms.php
Created November 10, 2015 03:45
Test for MDL-52081
<?php
include "config.php";
require_once($CFG->libdir.'/formslib.php');
$PAGE->set_url(new moodle_url('/test.php'));
$PAGE->set_context(context_system::instance());
class test_form extends moodleform {
Prefixes of db tables on prototype.moodle.net that do not seem to be used:
25544_
anom_
clean21_
clean2_
clean_
editors_
elis_
em_
<?php
findsum(array(6,5,4,3,2,1),3);
findsum(array(6,5,4,3,2,1),5);
findsum(array(6,5,4,3,2,1),7);
findsum(array(6,5,4,3,2,1),1);
findsum(array(6,5,4,3,2,1),9);
findsum(array(6,5,4,3,2,1),11);
findsum(array(1,2,3,4,5,6,7,8),9);