Documentation for Javascript code in RStudio? - rstudio

RStudio has support for ROxygen for generating documentation for R code. My R package has a fair bit of Javascript code in it. Has anyone written an RStudio plugin to support Javascript documentation, using JSDoc for example?
I'd like the equivalent of "Insert ROxygen skeleton", which isn't trivial to write myself, since it needs to parse the following Javascript.

There's now a prototype addin for RStudio to do this. It currently uses the development version of the js package, so you'll need two Github installs to use it:
devtools::install_github("jeroen/js")
devtools::install_github("dmurdoch/JSDocPlugin")
See the ?insertJSDocAddin help topic for instructions on how to install it with a keyboard shortcut.
Comments or pull requests on https://github.com/dmurdoch/JSDocPlugin would be welcome.

Related

How to spellcheck R comments with RStudio on R source files?

How to conveniently spellcheck R comments with RStudio on R source files?
I am writing a package and I want it to look professional. Thanks to Oxygen, all package's documentation lives in R comments, which by default is excluded from spell checking. So even if spell checking functionality does exist in RStudio, I don't know how to use it.
The spelling package is great for this: https://github.com/ropensci/spelling.
devtools::install_github("ropensci/spelling")
spelling::spell_check_package() # path to package Project
RStudio 1.3 will include this feature; and it is possible to already try it out.
Well this is moot now that Rstudio has spellcheck for spin documents!
So, I write a lot of my lessons and examples for teaching using spin rather than markdown. It just makes for an easier flow. The problem is that there is no spell-check in a spin document, much like your package documentation example.
What I have resorted to is using the terminal then running a command line spellchecker on the document.
I'm on linux so here is my workflow.
save the file I am working let's say example_lesson.R (typos and all)
open the terminal pane of Rstudio and cd to the right folder
make sure the file example_lesson.R is there
run the spell-checker
> aspell check example_lesson.R
Once I'm done with aspell, I go back to the editor window in Rstudio and it updates what I am working on with the spell-checked version. I spin it and I am done.
I've only tested with small examples, but it has worked thus far. Your mileage may vary. Hope that helps.

Elixir Phoenix inlining css for sending emails

I am sending emails using the mailgun library in Phoenix.
Turns out that when i look at the email in my gmail account, it has been stripped off of all the css classes and the link to external css files.
Mailgun suggests using a css inline library http://blog.mailgun.com/transactional-html-email-templates/
Tried search a lot, but could not find a css inline library for Phoenix/Elixir like the premailer gem in Ruby.
Does anyone know of a way to achieve this?
I just released Smoothie, an Elixir library that does just this. We use this in our product at the startup I run, and decided to write our own library as we also couldn't find one in the elixir ecosystem yet. Check out the github page for installation instructions. Let me know if it works for you!
There is also a library now called premailex which was released October 2017. It handles CSS inlining
I have not been able to find anything myself but I believe you can find tools for that online and use them, it's not exactly the same but I guess it's better than to inline everything manually. For instance, you could use this one. I have not tested it though.
Also you can create a package yourself and share it with us :)

Code completion for Sketchup Ruby API

Does anyone know of a program that has support for code completion for Sketchup Ruby API?
Here are some Ruby IDEs that have code completion:
JetBrains RubyMine: http://www.jetbrains.com/ruby/
NetBeans Ruby plugin: http://wiki.netbeans.org/Ruby
Unfortunately, it looks like you might need to do some work to get the Sketchup API symbols loaded into your IDE of choice. If I come across anything, I'll edit this answer.
You might also try posting to their mailing list to see if they have any ideas: http://groups.google.com/group/google-sketchup-developers
I found a code-completion addon for Notepad++. I added the SketchUp Ruby API methods to the Ruby code completion. Though I think it needs updating to support SU8's methods. I don't remember where I found it, but pretty sure it was somewhere on the SketchUcation forum: http://forums.sketchucation.com/
I'll post back if I find it.

BlogEngine.Net Code Formatting Extension that works?

For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of an extension that works, or a different approach that will allow me to make code samples pretty on my blog without hacking the crap out of the HTML myself?
Thanks.
I would try using Windows Live Writer along w/ the Paste From Visual Studio plugin. One you go WLW, you'll never go back to that damn TinyMCE interface.
WLW here:
http://get.live.com/writer/overview
Plugin here:
http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&l=8
Thanks, Rafe. Thanks to this post that Hanselman put up the day after I asked the question, I downloaded WLW and am now using it. As far as getting prettily formatted code, I'm using cut-and-paste from a little tool developed and available on manoli.net.
Check out SyntaxHighlighter.. Works excellent. For easy integration into BlogEngine have a look at my blog post.

Code syntax formatter for posting code on webpages

Is there a utility that will generate html or css for blocks of code (.net c#) when you post it on a website?
I have seen several websites with very nicely formatted code and I dont believe they do this manually.
Google prettify -
http://code.google.com/p/google-code-prettify/
I prefer Syntax Highlighter implementations (I'm using Wordpress plugin implementation for my blog).
Advantages
It is based on JavaScript and does
not care about what you have on the
server.
Posts with this formatting display
properly on different RSS feeds and
can be copied to clipboard.
It is trivial to extend syntax
rules. I'm using that to highlight
custom operators in Boo-based DSL (see sample post)
Multiple languages are supported
out-of-the-box
(source: googlecode.com)
You can get JavaScript syntax-highlighting scripts, such as this one by Dean Edwards.
This is also a jQuery version apparently based on it which looks good.
CopySourceAsHtml is an add-in for Microsoft Visual Studio 2005 that allows you to copy source code, syntax highlighting, and line numbers as HTML.
http://copysourceashtml.codeplex.com
It's highly configurable, and works much better than the download page would make you expect! Don't know if there is something similar for VS 2008
If you don't have the ability to add the google prettifier CSS reference, this would be a better way to go, as what you get is a complete HTML with the required style. I use it all the time on our developers wiki, and loving it.
An even better solution, if you don't want to bother installing anything, is to just use the little web app I wrote called BlogTrog CodeWindow:
http://www.blogtrog.com
It's easy to use. Just paste your code and embed the results.

Resources