Skip to content

Instantly share code, notes, and snippets.

View rajeshtaneja's full-sized avatar

Rajesh Taneja rajeshtaneja

View GitHub Profile
@rajeshtaneja
rajeshtaneja / 0_reuse_code.js
Created July 13, 2016 03:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rajeshtaneja
rajeshtaneja / webdriver.jmx
Created June 24, 2015 08:31
Webdriver jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="Site" elementType="Argument">
@rajeshtaneja
rajeshtaneja / autoload
Created June 19, 2015 07:03
Move known classes to autoloading
diff --git a/lib/classes/component.php b/lib/classes/component.php
index 95f9044..402aa12 100644
--- a/lib/classes/component.php
+++ b/lib/classes/component.php
@@ -69,6 +69,14 @@ class core_component {
protected static $filestomap = array('lib.php', 'settings.php');
/** @var array cache of PSR loadable systems */
protected static $psrclassmap = null;
+ /** @var array list of known classes. */
+ protected static $knownclasses = array(
@rajeshtaneja
rajeshtaneja / Test script
Last active August 29, 2015 14:23
Test script to check performance improvement with UNION ALL
<?php
/*
* Test script to loop though get_user_access_sitewide()
* for each user to get performance results with UNION ALL
*/
define('CLI_SCRIPT', true);
include_once("config.php");
// Max users to get access info of.
#!/bin/bash
################################
#!# SiteId=behat_whole_suite_m
#!# OutputFormat=moodle_progress,junit
################################
# Optional Params.
if [ -z "${BehatProfileToUseOnDay}" ]; then
BehatProfileToUseOnDay="default default default default default default default"
fi
if [ -z "${SELENIUMPORT}" ]; then
@rajeshtaneja
rajeshtaneja / travis
Created February 27, 2015 03:18
travis.yml
notifications:
email:
recipients:
- rajesh@moodle.com
on_success: never
on_failure: always
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
language: php
@rajeshtaneja
rajeshtaneja / test
Created February 26, 2015 06:39
Shell script for multiple behat
#!/bin/bash
# Number of parallel runs.
NUMBEROFPARALLELRUNS=20
# Max parallel install.
MAXPARALLELINSTALL=20
MAXDB=5
@rajeshtaneja
rajeshtaneja / preview_question.feature
Created November 12, 2014 09:19
Check preview_question page with specific scenarios
@core @core_question @_switch_window
Feature: A teacher can preview questions in the question bank
In order to ensure the questions are properly created
As a teacher
I need to preview the questions
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
domain = 'moodle.local'
nodes = [
{ :hostname => 'apache01', :ip => '192.168.100.191', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box'},
{ :hostname => 'apache02', :ip => '192.168.100.192', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box'},
{ :hostname => 'apache03', :ip => '192.168.100.193', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box', :ram => '2048'},
{ :hostname => 'apache04', :ip => '192.168.100.194', :box => 'Official Ubuntu 14.04 daily Cloud Image i386 (Development release, No Guest Additions)', :url => 'file:///tmp/trusty-server-cloudimg-i386-vagrant-disk1.box', :ram => '2048'},
]
VAGRANTFILE_API_VERSION = "2"
@rajeshtaneja
rajeshtaneja / config
Created June 18, 2014 06:21
Behat config for phantomjs and chrome.
Add following to $CFG->behat_config
'phantomjs' => array(
'filters' => array(
'tags' => '~@_switch_window&&~@_file_upload&&~@_alert&&~@_bug_phantomjs&&@javascript'
),
'extensions' => array(
'Behat\MinkExtension\Extension' => array(
'selenium2' => array(
'browser' => 'phantomjs',