Skip to content

Instantly share code, notes, and snippets.

View catrope's full-sized avatar

Roan Kattouw catrope

  • Wikimedia Foundation
  • San Francisco, CA
View GitHub Profile
@catrope
catrope / typedoc.json
Created October 25, 2022 23:43
Typedoc output for Codex
{
"id": 0,
"name": "@wikimedia/codex",
"kind": 1,
"kindString": "Project",
"flags": {},
"originalName": "",
"children": [
{
"id": 2,
@catrope
catrope / MyComponent.stories.ts
Created April 29, 2021 19:27
Storybook boilerplate for WVUI
import Vue from 'vue';
import { Args, StoryContext } from '@storybook/addons';
import WvuiMyComponent from './MyComponent.vue';
import { filterKeys, makeActionArgTypes, makeActionListeners } from '../../utils/StoryUtils';
import './MyComponent.stories.less'; // Optional, use if your story requires additional styles
export default {
title: 'Components/MyComponent',
component: WvuiMyComponent,
argTypes: {
Pct 1101 Jane Kim 81
Pct 1101 London Breed 82
Pct 1101 Mark Leno 99
Pct 1101 exhausted 17
Pct 1101 undervote 1
Pct 1102 Jane Kim 125
Pct 1102 London Breed 224
Pct 1102 Mark Leno 142
Pct 1102 exhausted 32
Pct 1102 undervote 5
@catrope
catrope / round7-d6.md
Created November 5, 2018 00:10
Last two round totals per precinct in D6 (2018 SF Mayor's race)

sqlite> select precinct, round7, count(*) from ballots where contest='Mayor' and district=6 and round7 not in ('exhausted', 'undervote', 'overvote') group by precinct, round7;

precinct round7 count(*)
Pct 7601 Jane Kim 90
Pct 7601 London Breed 101
Pct 7601 Mark Leno 92
Pct 7602 Jane Kim 125
Pct 7602 London Breed 119
Pct 7602 Mark Leno 119
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="foo"></div>
</body>
</html>
sh: 1: Syntax error: Unterminated quoted string
array(1) {
[""]=>
string(9) "example-2"
}
@catrope
catrope / gist:8aa482d662b850f8f198b55f3c0a4653
Last active July 6, 2017 17:23
What does this PHP snippet output?
<?php
$tomorrowDate = ['20170706', '102026'];
var_dump( [
`action=blah&pageid=1&date={{$tomorrowDate[0]}}&comment='example`
=> 'example-1',
`action=blah&pageid=1&date={{$tomorrowDate[0]}}`
=> 'example-2',
] );
Echo
188e8d7 No-JS special page: One-click mark as read
f751e96 Unread pages API
0706567 Adjust styling for Special:Notification items
acc672c Darken the dates in the Special:Notifications groups
6e21a62 Clean up the pagination in Special:Notifications
cf99479 Display a message if there are no notifications in Special:Notifications
6ad1abc Cleanup DiscussionParser
f88c90e Fix notification pager
b3d1689 Maintenance: Backfill read timestamp on bundled notifications
$.ajax( {
// Get this URL
url: '/api/rest_v1/page/html/' + mw.config.get( 'wgPageName' ),
// Interpret the result as HTML (as opposed to XML or JSON or something)
dataType: 'html'
} )
.done( function( html ) {
// Parse the result as HTML
var doc = new DOMParser().parseFromString( html, 'text/html' ),
// You can now use jQuery to find stuff using $( 'selector', doc )
@catrope
catrope / gist:6367c64591bd9d39b9dc591ebf2c3e12
Created May 12, 2016 05:05
Cross-wiki notification beta feature usage as of 2016-05-12 05:00 UTC
TOTAL: 22,183 accounts across 415 wikis
7772 enwiki
1226 ruwiki
1203 frwiki
1154 eswiki
1045 dewiki
931 commonswiki
769 zhwiki
586 arwiki