Skip to content

Instantly share code, notes, and snippets.

View trevorparscal's full-sized avatar

Trevor Parscal trevorparscal

View GitHub Profile
Trevor-Parscals-MacBook-Air:wikidom tparscal$ svn commit -m "Added auto-scrolling when the cursor is moved and fixed some syntax issues that jshint caught"
Sending lib/synth/views/es.SurfaceView.js
Transmitting file data .svn: Commit failed (details follow):
svn: Commit blocked by pre-commit hook (exit code 255) with no output.
@trevorparscal
trevorparscal / gist:5631224
Created May 22, 2013 21:49
oojs module template
/* Local Symbols */
( function ( oo, $ ) {
/* Your code here */
/* Global Symbols */
}( ObjectOrientedJavaScript, jQuery ) );
/**
* @inheritdoc
*/
ve.ui.LinkInspector.prototype.setup = function ( data ) {
var focusedNode = this.surface.getView().getFocusedNode();
if (
focusedNode &&
ve.isInstanceOfAny( focusedNode.getModel(), this.constructor.static.modelClasses )
/**
* Capture event.
*
* Only works in IE9+.
*
* @todo Rework this so you can uncapture - which is tricky since
* we are wrapping the callback in a fixup function.
*
* @param {string} DOM event to capture
* @param {Function} Callback to execute when event is triggered
@trevorparscal
trevorparscal / gist:9495342
Created March 11, 2014 21:20
Example data for configuring citation tools.
var tools = [
{ 'name': 'web', 'icon': 'cite-web', 'template': 'Cite web', 'title': 'Web site' },
{ 'name': 'book', 'icon': 'cite-book', 'template': 'Cite book', 'title': 'Book' },
{ 'name': 'news', 'icon': 'cite-news', 'template': 'Cite news', 'title': 'News' },
{ 'name': 'journal', 'icon': 'cite-journal', 'template': 'Cite journal', 'title': 'Journal' }
];
function sync() {
if [ "$1" = "oo" ] ; then
oo
grunt
# Copy to OOJS UI
ooui
cp ~/Sites/oojs/core/dist/oojs.js lib/oojs.js
cd -
// Override mixins
@useInvertedIcons() {
&:extend(.oo-ui-icon-foo-inverted);
&:extend(.oo-ui-icon-bar-inverted);
// ...and more for each icon...
}
// ...and more for each version (normal, inverted, constructive, destructive, progressive)...
// Icon definitions
.oo-ui-icon-foo { foo.png; }
# Execute this in the root of the oojs-ui repo
# Find and replace script symbols
find . -name \*.js -exec sed -i '' \
-e 's/TextInputMenuWidget/TextInputMenuSelectWidget/g' \
-e 's/MenuWidget/MenuSelectWidget/g' \
-e 's/MenuItemWidget/MenuOptionWidget/g' \
-e 's/MenuSectionItemWidget/MenuSectionOptionWidget/g' \
-e 's/OutlineWidget/OutlineSelectWidget/g' \
-e 's/OutlineItemWidget/OutlineOptionWidget/g' \
# Execute this in the root of the ve repo
# Find and replace script symbols
find . -name \*.js -exec sed -i '' \
-e 's/ContextMenuWidget/ContextSelectWidget/g' \
-e 's/ContextItemWidget/ContextOptionWidget/g' \
-e 's/TextInputMenuWidget/TextInputMenuSelectWidget/g' \
-e 's/MenuWidget/MenuSelectWidget/g' \
-e 's/MenuItemWidget/MenuOptionWidget/g' \
-e 's/MenuSectionItemWidget/MenuSectionOptionWidget/g' \
# Execute this in the root of the ve mw repo
# Find and replace script symbols
find modules -name \*.js -exec sed -i '' \
-e 's/MWInternalLinkMenuItemWidget/MWInternalLinkMenuOptionWidget/g' \
-e 's/MWLinkMenuItemWidget/MWLinkMenuOptionWidget/g' \
-e 's/ContextMenuWidget/ContextSelectWidget/g' \
-e 's/ContextItemWidget/ContextOptionWidget/g' \
-e 's/TextInputMenuWidget/TextInputMenuSelectWidget/g' \
-e 's/MenuWidget/MenuSelectWidget/g' \