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
source /etc/bash_completion.d/git-prompt
GIT_PS1_SHOWDIRTYSTATE='yes'
function git_dirty {
# only tracks modifications, not unknown files needing adds
if [ -z "`git status -s 2> /dev/null | awk '{print $1}' | grep '[ADMTU]'`" ] ; then
return 1
else
return 0
fi
@catrope
catrope / gist:70117fa069eb7cec314a
Created October 17, 2014 20:02
RL definitions for images
'help' => 'help.png',
'undo' => array( 'image' => array( 'ltr' => 'move-left.png', 'rtl' => 'move-right.png' ) )
'next' => array( 'image' => array( 'ltr' => 'next.png', 'rtl' => 'prev.png' ) ),
'remove' => array( 'image' => 'remove.png', 'variants' => array( 'destructive' ) ),
'cite' => array( 'image' => 'cite.png', 'rtlflip' => true ), // ?
'bold' => array( 'image' => array( 'default' => 'bold-A.png', 'en' => 'bold-B.png', 'de' => 'bold-F.png' ) )
// could have 'default' => array( 'ltr' => ..., 'rtl' => ... )
'list' => array( 'image' => array( 'ltr' => 'list-ltr.png', 'rtl' => 'list-rtl.png' ))
677878d Update VE core submodule to master (a1c190c)
f41633d Revert "ve.ce.Surface: Magic workaround for broken Firefox cursoring"
3a5fe64 Add mobile target to 'ext.visualEditor.iehacks' module
d751d56 mw.Platform: Use 'mediawiki.language' for language fallback chain
0121c68 Display JSON configuration options in NS_MEDIAWIKI as JSON
71bb01a Update VE core submodule to master (cfd855e)
21bba98 update-oojs-ui.sh: Exclude the minimised distribution files
d9114f9 Update OOjs UI to v0.1.0-pre (48980881f3)
aafebc4 LookupInputWidget: Fix whitespace and documentation
@useInvertedIcons():
&:extend(.oo-ui-icon-foo-inverted);
&:extend(.oo-ui-icon-bar-inverted);
.oo-ui-icon-foo { foo.png; }
.oo-ui-icon-foo-inverted { foo-white.png; }
.oo-ui-flagged-constructive .oo-ui-icon-foo {
foo-green.png;
}
@catrope
catrope / gist:a231c9051434bb1cf119
Created July 30, 2014 08:42
Word break relocation hacks
diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index 2a018af..e826ab4 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -1636,8 +1636,52 @@ ve.ce.Surface.prototype.onContentChange = function ( node, previous, next ) {
next.range.start - nodeOffset - 1
);
// Apply insertion annotations
- annotations = node.unicornAnnotations || this.model.getInsertionAnnotations();
- ve.dm.Document.static.addAnnotationsToData( data, annotations );
@catrope
catrope / gist:dfe1daa1d586efa431ed
Created July 22, 2014 21:17
Insert <h2>Hello</h2> at the beginning
var html = '<h2>Hello</h2>',
htmlDoc = ve.createDocumentFromHTML( html ),
newDmDoc = ve.dm.converter.getModelFromDom( htmlDoc ), // Omitting targetDoc here, which may cause issues with link hrefs
surfaceModel = ve.init.target.getSurface().getModel(),
tx = ve.dm.Transaction.newFromDocumentInsertion( surfaceModel.getDocument(), 0, newDmDoc ); // 0 means insert at the beginning
surfaceModel.change( tx );
dc6840c Update displaytitle on save (try #3)
288da5b Compress HTML data with deflate before POSTing
ec8d31e build: Implement "git-status" task and run it in CI environment
19afd65 build: Update jscs and use new "wikimedia" preset
1dd64f8 Don't remove 'extension' from template names
0159620 Unimplement wgSVGMaxSize
a70a482 Update VE core submodule to master (aaa8547)
04d9484 Update OOjs UI to v0.1.0-pre (9aad824bd6)
414c051 build: Update jscs and use new "wikimedia" preset
0401aff Accessibility: Set aria-hidden attribute on elements while dialogs are open
function Bar() {
// Parent constructor
Bar.parent.call( this );
this.v2 = null;
}
OO.inheritClass( Bar, Foo );
Bar.prototype.setValue = function f( val ) {
// Call parent method
a850177 Switch from Parsoid extension's styles to MediaWiki core's
060fcab Detect that a category is hidden when following a redirect
a50e5c6 Preserve veaction, vesection on special redirects to wiki pages
bafad7e Remove DesktopContext.css/js from core, leave in desktop
d10f27e Make MWGalleryInspector wider
963e133 Remove media item styling moved to MW-core in I400336c12d.
805dbdd Update VE core submodule to master (1c1eb3a)
712be31 Followup 682b4d0b88: bring this.isSetup back
78fd10e Document that SurfaceFragment#getSelectedNode doesn't require selection
885bf01 Whitelist Opera 15+
29fc9ea Remove MWCommandHelpDialogTool
60672bd Update VE core submodule to master (ced9f77)
168146b inheritdoc lowercase
dc4173e build: Update jscs and grunt-watch
df29ea9 Pass HTMLDocument to convertToData
25d00cc build: Update jscs and jshint
2ef5468 mw.ViewPageTarget.init: Remove redundant hasOwn check
411f0a7 Set up edit notices for things like unknown browsers on each activation