Skip to content

Instantly share code, notes, and snippets.

@eliardocosta
Created July 28, 2017 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliardocosta/b855ed4cf373c4ea0dfb80227cc62335 to your computer and use it in GitHub Desktop.
Save eliardocosta/b855ed4cf373c4ea0dfb80227cc62335 to your computer and use it in GitHub Desktop.
Adding a snippet to insert MIT License in RStudio scripts.

1- Go to Tools -> Global Options -> Code -> Snippets -> Edit Snippets.
2- Then paste the following code:

snippet mit
	`r paste('#  script.R')`
	`r paste('#')`
	`r paste('#  The MIT License (MIT)')`
	`r paste('#')`
	`r paste('#  Copyright (c)', format(Sys.time(), "%Y"), '<Your name>')`
	`r paste('#')`
	`r paste('#  Permission is hereby granted, free of charge, to any person obtaining a copy of')`
	`r paste('#  this software and associated documentation files (the "Software"), to deal in')`
	`r paste('#  the Software without restriction, including without limitation the rights to')`
	`r paste('#  use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of')`
	`r paste('#  the Software, and to permit persons to whom the Software is furnished to do so,')`
	`r paste('#  subject to the following conditions:')`
	`r paste('#')`
	`r paste('#  The above copyright notice and this permission notice shall be included in all')`
	`r paste('#  copies or substantial portions of the Software.')`
	`r paste('#')`
	`r paste('#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR')`
	`r paste('#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS')`
	`r paste('#  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR')`
	`r paste('#  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER')`
	`r paste('#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN')`
	`r paste('#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.')`
	`r paste('\n')`

To use this snippet in the script type mit then Shift+Tab.

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