Skip to content

Instantly share code, notes, and snippets.

@dmonllao
dmonllao / gist:9044460
Created February 17, 2014 03:53
Patch for Moodle 2.5 to output the DOM status in the CLI when a scenario fails
From 328f9f77ed72186419f1abc56c1baccf268153fb Mon Sep 17 00:00:00 2001
From: David Monllao <[email protected]>
Date: Mon, 17 Feb 2014 11:52:20 +0800
Subject: [PATCH] For Moodle 2.5 - Output the DOM in the CLI window
---
lib/tests/behat/behat_hooks.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php
@dmonllao
dmonllao / gist:9181186
Created February 24, 2014 02:54
PhantomJS crash when running behat (seems that when creating an screenshot)
Operating system: Linux
0.0.0 Linux 3.2.0-56-generic #86-Ubuntu SMP Wed Oct 23 09:20:45 UTC 2013 x86_64
CPU: amd64
family 6 model 44 stepping 2
4 CPUs
Crash reason: SIGSEGV
Crash address: 0xf64034
Thread 0 (crashed)
@dmonllao
dmonllao / resolve_rebase_conflicts_test.sh
Last active May 5, 2016 07:46
rebase_security.sh automatically resolving conflicts
#!/bin/bash
##
# This file exposes the behaviour of the conflicts resolution function.
# * You need to clone https://github.com/dmonllao/moodle-local_ci somewhere and checkout 'autoresolver' branch
# and ln -s /LOCAL_CI/PATH/resolve_rebase_conflicts_test.sh /MOODLECLONE/PATH/
# * Comment out $gitcmd clean -dfx from rebase_security/rebase_security.sh
# * I'm using a couple of repos in [email protected]:davidm to test this resetting HEAD to a hardcoded
# old weekly commits after each execution, something like this below:
#
#!/bin/bash
set -e
UBUNTURELEASE="ubuntu-trusty"
GITUSERNAME="David Monllao"
GITUSEREMAIL="[email protected]"
DBPASSWORD="moodle"
#!/bin/bash
set -e
gnome-terminal --maximize &> /dev/null &
/opt/google/chrome/google-chrome --profile-directory=Default https://mail.google.com https://tracker.moodle.org &> /dev/null &
pidgin &> /dev/null &
/home/davidm/Telegram/Telegram &> /dev/null &
RESULTS:
➜ php-ml-fork git:(partial-train) ✗ php memory-usage.php
string(18) "perceptron: 522368"
string(15) "adaline: 490576"
string(16) "logistic: 484832"
➜ php-ml-fork git:(cost-values-key) ✗ php memory-usage.php
string(17) "perceptron: 77312"
string(14) "adaline: 45520"
string(15) "logistic: 32864"
@dmonllao
dmonllao / gist:a938c77d6230ccdf6285d84615223e1f
Last active April 19, 2017 06:42
php-ml linear classifier performance (partial training vs full training in 1 batch) (https://github.com/php-ai/php-ml/pull/78)
RESULTS:
➜ php-ml git:(partial-train) ✗ clear ; php partial-vs-full.php
Classifier perceptron full train memory usage:
Usage from before data reading to end of training: 231704
Classifier adaline full train memory usage:
Usage from before data reading to end of training: 265160
Classifier logistic full train memory usage:
Usage from before data reading to end of training: 248408
Classifier perceptron partial train memory usage:
Usage from before data reading to end of training: 9176
<?php
define('CLI_SCRIPT', true);
require_once(__DIR__ . '/config.php');
$latest = $DB->get_records_select('files', "component = 'analytics' AND filename = 'evaluation.csv' AND filepath LIKE '/timesplitting/%'", array(), 'timecreated DESC', '*', 0, 1);
$id = key($latest);
$fs = get_file_storage();
$f = $fs->get_file_by_id($id);
+ <TABLE NAME="tool_dataprivacy_ctxexpired" COMMENT="Default comment for the table, please edit me">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
+ <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="status" TYPE="int" LENGTH="2" DEFAULT="0" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timeexpired" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+ </FIELDS>
diff --cc theme/boost/templates/core/filemanager_modal_generallayout.mustache
index 3e31b35,5741947..0000000
--- a/theme/boost/templates/core/filemanager_modal_generallayout.mustache
+++ b/theme/boost/templates/core/filemanager_modal_generallayout.mustache
@@@ -1,9 -1,9 +1,8 @@@
- <div tabindex="0" class="file-picker fp-generallayout container-fluid row" role="dialog" aria-live="assertive">
- <div class="fp-repo-area col-md-3 nav nav-pills nav-stacked" role="tablist">
+ <div tabindex="0" class="file-picker fp-generallayout row" role="dialog" aria-live="assertive">
- <div class="fp-repo-area col-md-3 nav nav-pills flex-column">
- <div class="fp-repo nav-item">