Skip to content

Instantly share code, notes, and snippets.

@japgolly
Last active August 29, 2015 14:11
Show Gist options
  • Save japgolly/c68482dbadb0077f550c to your computer and use it in GitHub Desktop.
Save japgolly/c68482dbadb0077f550c to your computer and use it in GitHub Desktop.
scalajs-react 0.7.0 migration
#!/bin/bash
find . -name '*.scala' -exec perl -pi -e '
s/(?!<[a-zA-Z0-9_"])onblur(?![a-zA-Z0-9_"])/onBlur/g;
s/(?!<[a-zA-Z0-9_"])onchange(?![a-zA-Z0-9_"])/onChange/g;
s/(?!<[a-zA-Z0-9_"])onclick(?![a-zA-Z0-9_"])/onClick/g;
s/(?!<[a-zA-Z0-9_"])ondblclick(?![a-zA-Z0-9_"])/onDblClick/g;
s/(?!<[a-zA-Z0-9_"])onfocus(?![a-zA-Z0-9_"])/onFocus/g;
s/(?!<[a-zA-Z0-9_"])onkeydown(?![a-zA-Z0-9_"])/onKeyDown/g;
s/(?!<[a-zA-Z0-9_"])onkeyup(?![a-zA-Z0-9_"])/onKeyUp/g;
s/(?!<[a-zA-Z0-9_"])onkeypress(?![a-zA-Z0-9_"])/onKeyPress/g;
s/(?!<[a-zA-Z0-9_"])onload(?![a-zA-Z0-9_"])/onLoad/g;
s/(?!<[a-zA-Z0-9_"])onmousedown(?![a-zA-Z0-9_"])/onMouseDown/g;
s/(?!<[a-zA-Z0-9_"])onmousemove(?![a-zA-Z0-9_"])/onMouseMove/g;
s/(?!<[a-zA-Z0-9_"])onmouseout(?![a-zA-Z0-9_"])/onMouseOut/g;
s/(?!<[a-zA-Z0-9_"])onmouseover(?![a-zA-Z0-9_"])/onMouseOver/g;
s/(?!<[a-zA-Z0-9_"])onmouseup(?![a-zA-Z0-9_"])/onMouseUp/g;
s/(?!<[a-zA-Z0-9_"])onselect(?![a-zA-Z0-9_"])/onSelect/g;
s/(?!<[a-zA-Z0-9_"])onscroll(?![a-zA-Z0-9_"])/onScroll/g;
s/(?!<[a-zA-Z0-9_"])onsubmit(?![a-zA-Z0-9_"])/onSubmit/g;
s/(?!<[a-zA-Z0-9_"])onreset(?![a-zA-Z0-9_"])/onReset/g;
s/(?!<[a-zA-Z0-9_"])colspan(?![a-zA-Z0-9_"])/colSpan/g;
s/(?!<[a-zA-Z0-9_"])rowspan(?![a-zA-Z0-9_"])/rowSpan/g;
s/(?!<[a-zA-Z0-9_"])autocomplete(?![a-zA-Z0-9_"])/autoComplete/g;
s/(?!<[a-zA-Z0-9_"])autofocus(?![a-zA-Z0-9_"])/autoFocus/g;
s/(?!<[a-zA-Z0-9_"])readonly(?![a-zA-Z0-9_"])/readOnly/g;
s/(?!<[a-zA-Z0-9_"])tabindex(?![a-zA-Z0-9_"])/tabIndex/g;
s/(?<!\w)Tag(?!\w)/ReactTag/g;
s/(?<!\w)Modifier(?!\w)/TagMod/g;
s/(import .*)ReactVDom[., _{=>}a-zA-Z]+(?=all)/\1/g;
' {} +
@japgolly
Copy link
Author

japgolly commented Jan 3, 2015

It seems I don't get notifications from gists. Must be an older version of find? I remember . being required years and years back, maybe on my old nas.

It's not the case anymore with the version I'm using

> find -version
find (GNU findutils) 4.4.2
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS() CBO(level=0) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment