Skip to content

Instantly share code, notes, and snippets.

View jdlrobson's full-sized avatar

Jon Robson jdlrobson

View GitHub Profile
@jdlrobson
jdlrobson / analyseThis.py
Last active February 16, 2019 14:14
Analyse SQL dumps of raw EventLogging NavigationTiming data for median and p95 percentile
import numpy as np
import csv
import json
import sys
import datetime
def get_data( filename, from_ts, to_ts, metric, wiki=None, http2=None, anon=None, lazy = None ):
sample = []
f = open( filename )
delim = '\t'
diff --git a/package.json b/package.json
index 1a709407c..fb4b9072f 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"nyc": "13.0.1",
"oojs": "2.2.2",
"pre-commit": "1.2.2",
+ "preact": "8.4.2",
"qunit": "2.7.0",
@jdlrobson
jdlrobson / proxy.js
Created May 9, 2018 19:23
API proxy
const express = require('express');
const wikiApis = require('express-wikimedia-api-proxy');
const app = express();
const cors = require('cors');
const PORT = 8090
const base = '/api/';
app.use(cors())
wikiApis(app, base, true);
app.listen(PORT)
@jdlrobson
jdlrobson / proxy.js
Created May 9, 2018 19:23
API proxy
const express = require('express');
const wikiApis = require('express-wikimedia-api-proxy');
const app = express();
const cors = require('cors');
const PORT = 8090
const base = '/api/';
app.use(cors())
wikiApis(app, base, true);
app.listen(PORT)
@jdlrobson
jdlrobson / CategoryOverlay.js
Created April 3, 2018 21:07
Ideas for category rewrite
const Tabs = () => {
// to be implemented but would deal with all the tab magic.
};
const Header = ( { title, actions } ) => {
// to be implemented
}
// CategoryOverlay becomes an Overlay without any async properties.
// Very easy to test and easier to tweak
{"words":{"土":"soil/earth","水":"water","山":"mountain","瓜":"melon","花":"flower","果":"fruit","苦":"bitter","西":"west","西瓜":"watermelon","苦瓜":"bitter gourd","虹":"rainbow","虫":"insect","工":"work","火山":"volcano","火":"fire","云":"cloud","萝卜":"radish","风":"wind","冬":"winter","电":"electricity","夏":"summer","桃":"peach","木":"wood","瀑":"waterfall/shower","土豆":"potato","豆":"beans/pea","苹果":"apple","茄":"eggplant","子":"son","茄子":"eggplant","星":"star","日":"sun (☀️)","生":"give birth","星期一":"monday","期":"period(time)","一":"one","星期二":"tuesday","二":"two","香蕉":"banana","香":"fragrant","饭团":"rice ball","团":"group","饭":"meal/food","杏":"apricot","口":"mouth","饼":"pastry/cake","鱼":"fish","海鲜":"seafood","海":"sea","面包":"bread","陨石":"aerolite","石":"stone","陨":"fall from sky","石榴":"pomegranate","田":"field","糕点":"pastry","饺":"dumpling","大":"big","人":"person","夫人":"madam","夫":"man","天":"sky","天人":"heaven","森":"forest","林":"in the woods","本":"foundation","玉":"jade","女":"woman/daughter","羊":"sheep","牛":"cow","白":"white","雨":"rain","士":"soldier
diff --git a/includes/BookRenderingMediator.php b/includes/BookRenderingMediator.php
index 9d30550..400aec7 100644
--- a/includes/BookRenderingMediator.php
+++ b/includes/BookRenderingMediator.php
@@ -192,10 +192,7 @@ class BookRenderingMediator implements LoggerAwareInterface {
'electron' => ElectronVirtualRestService::class,
];
foreach ( $modules as $module => $class ) {
- if ( !isset( $config['modules'][$module] ) ) {
- throw new Exception( "VirtualRESTService module $module is not configured propely" );
@jdlrobson
jdlrobson / T169823.css
Last active September 2, 2017 21:36
T169823.css
/* pint css */
/* This css files can be applied to any wikipedia article.
Note: remove any other css applied to page. this is the only css needed to print.
*/
/*
- Have some padding and body typeface
- Turn color to pure black. good for printing pure black
*/
@jdlrobson
jdlrobson / p.diff
Created August 23, 2017 19:37
p.diff
diff --git a/includes/specials/SpecialMobileLanguages.php b/includes/specials/SpecialMobileLanguages.php
index 735645e..d30655c 100644
--- a/includes/specials/SpecialMobileLanguages.php
+++ b/includes/specials/SpecialMobileLanguages.php
@@ -22,22 +22,11 @@ class SpecialMobileLanguages extends MobileSpecialPage {
* @return array
*/
private function getLanguages() {
- $api = new ApiMain(
- new DerivativeRequest(
@jdlrobson
jdlrobson / CustomElement.html
Created August 18, 2017 17:44
CustomElement.html - autocomplete
<!DOCTYPE HTML>
<html>
<head>
<title>Custom element autocomplete</title>
</head>
<body>
<h1>CustomElement AutoComplete</h1>
<p>
Upgrades a standard select element to work like an autocomplete by using CustomElements.
It will degrade on older browsers that do not support elements to a select dropdown.