Skip to content

Instantly share code, notes, and snippets.

View jamesmontalvo3's full-sized avatar

James Montalvo jamesmontalvo3

View GitHub Profile
@jamesmontalvo3
jamesmontalvo3 / interview.js
Last active September 15, 2023 15:40
JS fundamental questions
/**
* The following examples help ensure understanding of some JavaScript fundamentals.
* Please make sure you understand these prior to the interview. Deep knowledge of JS is
* not required for the interview, but these fundamentals are.
*
* The third and final example is less about JS fundamentals, and is simply to show an
* example of using recursion. One interview question will involve recursion.
*
* You can try out running this code in your browser by opening the JavaScript console.
* Open developer tools and go to console. On some browsers/OS you can do ctrl+shift+j.
{
"version": {
"name": "mdJson",
"version": "1.0.0"
},
"contact": [
{
"contactId": "1",
"organizationName": "US Geological Survey - Alaska Science Center"
}
@jamesmontalvo3
jamesmontalvo3 / composer.md
Created June 26, 2019 23:03
Composer issue

Getting a weird error due to Composer installs right now.

[Wed Jun 26 16:16:18.364715 2019] [php7:warn] [pid 12304] [client my.ip.add.ress:46156] PHP Warning:  require(/opt/htdocs/mediawiki/vendor/composer/../jetbrains/phpstorm-stubs/PhpStormStubsMap.php): failed to open stream: No such file or directory in /opt/htdocs/mediawiki/vendor/composer/autoload_real.php on line 70, referer: https://example.com/
[Wed Jun 26 16:16:18.364896 2019] [php7:error] [pid 12304] [client my.ip.add.ress:46156] PHP Fatal error:  require(): Failed opening required '/opt/htdocs/mediawiki/vendor/composer/../jetbrains/phpstorm-stubs/PhpStormStubsMap.php' (include_path='/opt/htdocs/mediawiki/vendor/pear/console_getopt:/opt/htdocs/mediawiki/vendor/pear/mail:/opt/htdocs/mediawiki/vendor/pear/mail_mime:/opt/htdocs/mediawiki/vendor/pear/mail_mime-decode:/opt/htdocs/mediawiki/vendor/pear/net_smtp:/opt/htdocs/mediawiki/vendor/pear/net_socket:/opt/htdocs/mediawiki/vendor/pear/pear-core-minimal/src:/opt/htdocs/mediawiki/vendor/pear/pear_
@jamesmontalvo3
jamesmontalvo3 / phpunit.meza.mw1.30.md
Last active April 13, 2018 20:52
PHP unit test logs for meza
  1. MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest::testOnUserGroupsChanged
Missing argument 4 for EchoHooks::onUserGroupsChanged()

/opt/htdocs/mediawiki/extensions/Echo/Hooks.php:704
/opt/htdocs/mediawiki/includes/Hooks.php:177
/opt/htdocs/mediawiki/includes/Hooks.php:205
/opt/htdocs/mediawiki/tests/phpunit/includes/auth/AuthPluginPrimaryAuthenticationProviderTest.php:76
@jamesmontalvo3
jamesmontalvo3 / Comparison-of-Main-Page.md
Last active June 13, 2017 20:22
Meza 2-app-server config

Multi-app server loading [[Main Page]]

Request # Request time (microseconds) server request
1 2567734 App2 /demo/index.php/Main_Page
2 430673 App1 /demo/load.php?debug=false&lang=en&modules=ext.collapsiblevector.collapsibleNav%7Cext.headertabs%7Cext.uls.pt%7Cext.visualEditor.targetLoader%7Cjquery.checkboxShiftClick%2CgetAttrs%2ChighlightText%2CmakeCollapsible%2Cmw-jump%2Cplaceholder%2Csuggestions%7Cmediawiki.page.ready%7Cmediawiki.searchSuggest%7Csite&skin=vector&version=43da68dba780
3 2691265 App2 /demo/load.php?debug=false&lang=en&modules=ext.jquery.async%2Cqtip%7Cext.smw%7Cext.smw.tooltip%2Ctooltips%7Cext.smw.tooltip.styles&skin=vector&version=0ab62dfb598f
4 434904 App1 /demo/load.php?debug=false&lang=en&modules=ext.meetingminutes.template%7Cext.uls.init%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.supportCheck%2Ctrack%2Cve%7
@jamesmontalvo3
jamesmontalvo3 / importing.md
Created April 19, 2017 14:06
Importing a wiki with `meza deploy`

There is no import script anymore in the latest version of meza. Instead users should do sudo meza deploy monolith --overwrite with the appropriate backup files in place. Unfortunately this is not documented well in meza yet. This gist is intended as temporary documentation. It would be great if someone created a pull request into meza with this (cleaned up and verified) as official documentation.

There's more than one way this could be done, but this is one way. From the ground up in VirtualBox, get your VM configured. Skip this if you already have a running meza installation.

sudo ifup enp0s3
curl -L getmeza.org > doit
sudo bash doit
sudo meza setup dev-networking
@jamesmontalvo3
jamesmontalvo3 / phash.sh
Created February 28, 2017 00:07
Install phash
#!/bin/sh
#
#
# Download required libraries
cd ~
mkdir download
cd download
@jamesmontalvo3
jamesmontalvo3 / simpler-load-test.js
Last active January 18, 2017 23:21
Even simpler load testing script
// A very simple load-testing script
// Fires off requests to MediaWiki random page, fires another after receiving response
// Optionally multi-threaded.
var help = "Commands: \n"
+ "showData(): Display data in tab-delimited format\n"
+ "start(): Start sending requests\n"
+ "stop(): Stop sending requests\n"
+ "doForSeconds(seconds): Send requests for specified number of seconds\n"
+ "doForMinutes(minutes): Same as above, but for minutes\n"
@jamesmontalvo3
jamesmontalvo3 / simple-load-test.js
Last active January 18, 2017 20:23
Very simple load tester for MediaWiki
window.data = {};
window.lastUid = null;
window.cooldown = 0;
window.pending = {};
function requestPage ( interval, loadTestEnd ) {
// var milliseconds = Date.now();
@jamesmontalvo3
jamesmontalvo3 / Split.js
Created March 3, 2016 01:09
Split a file every 20000 lines
fs = require('fs');
path = require('path');
var log = path.join( path.dirname( fs.realpathSync(__filename) ), 'meza-dev.log' );
fs.readFile( log, 'utf8', function(err,data){
if (err) {
return console.log(err);
}