update R presentation in Rpubs instead of creating a new presentation [duplicate] - r

Is it possible to replace/overwrite my markdown document in the RPubs?

There is a option of republish once you select the option Knit to HTML for the same file once again. In that, it has option Update Existing. If its selected file gets updated without the URL being changed.

I dont think there is a direct way to update a file. But this is what you can do:
You can delete the file and upload a new one and insert the same slug during the upldoad. If you do this, the url of the file wont change.

Related

TOC not displaying in Blogdown post (Hugo theme Even)

I have added a new post to my site made using blogdown. Despite the presence of toc: yes in my YAML, the table of contents is not displaying on the rendered webpage. I've also tried adding:
output:
blogdown::html_page:
toc: yes
which doesn't solve the problem either. I'm currently using the Even theme (Hugo), and in the .config file, I also have toc: yes present.
I checked out this post, but I wasn't able to find the files they are referencing, nor those particular lines of code. Also my issue is with new posts, not the home page.
Does anyone know what the problem might be?
EDIT: I can see in my index.html file (generated from index.Rmd) that the code for a toc is present. For some reason, it's not being rendered on the page?
TL;DR Solution: to get the table of contents to show in the Even theme, your posts must render to the .markdown format instead of .html format. In order to make this happen, you simple use the .Rmarkdown file extension when creating the post instead of .Rmd. Now, when you use blogdown::serve_site(), your post will use the output format .markdown instead of .html. Your post will now render with a beautiful table of contents.
A note for latex math mode users: when typing in your .Rmarkdown document, you will now have to escape your $'s and \'s. So for example, $\le 0.2$
will have to be typed as \$\\le 0.2\$.
I hope this overly elaborate problem and solution is helpful to someone!
I figured out a workaround for this.
First, I'm not sure how to provide a reproducible example in this context, but I can say that if you open an RStudio project, run blogdown::new_site(theme = "olOwOlo/hugo-theme-even"), add a New Post using the Addin dropdown menu, add some headings to your post, make toc:true, use Serve Site from the Addin menu. You will see your post working fine in every respect - only it will be missing the table of contents.
Workaround:
I don't know why, but it appears that the table of contents will show if I keep a copy of the post in .md format, and delete the .html document. The default behavior seems to use the .html document if it is present; failing that, it will use the .md document.
To keep a copy of the post in .md format, use the following code in the YAML of your .Rmd document:
output:
blogdown::html_page:
keep_md: yes
Serve the site, delete the .html document (but keep the .md document), and the table of contents appears in all of its glory (you may have to actually knit the file to get the .md).
I don't know why this works...I've seen elsewhere (although I can't seem to find the post again) that some hugo themes don't play nicely with .html files, and prefer .md files, and that appears to be the case for the Even theme.
In sum: My workaround for now is thus to work on my posts, and when I'm done, knit the document with the option above, delete the .html file, and be on my way.
Caveat: blogdown seems to automatically re-render all the old posts when using Serve Site. According to this stack answer, Serve Site should only render documents that have undergone changes. Regardless, the old posts are most definitely being re-rendered, even when working on an unrelated post. I'm not sure if this behavior is attributable to blogdown per se, or the RStudio project.
I tried going to Tools -> Project Options -> Build Tools, and unchecking the boxes "Preview site when building", yet the behavior persists. Which means I will have to continuously delete these new .html files for all old posts every time a I make a change to any other file. Currently I only have one post, so not a big deal...yet.
If someone knows of a solution to this caveat, I would be extremely grateful. If I find one, I will edit this question and add it.
EDIT: it appears that blogdown will re-render the old post if there is no .html document present. Otherwise, it does not re-render it.
EDIT 2: Aha! According to the answer to this question, simply changing the file extension of the blog post from .Rmd to .Rmarkdown will produce a .markdown document instead of a .html document.

RStudio - selected code to snippet - updating r.snippets programmatically

I like using the RStudio snippets.
I thought it would be great, if i can select code and add it to the snippets by keyboard shortcut.
So i started working on it.
Even if I edit the r.snippets file programmatically, the created snippet seems only to be updated if the r.snippets file will be opened afterwards (in RStudio). As a workaround i call file.edit("~/.R/snippets/r.snippets") at the end of the code.
My question:
Does the file have to be opened or can the changes be recognised by
RStudio in another way as well?
Alternative:
It might be better practise to directly paste the selected code in the r.snippets file for the user(?)
Also asked here:
https://community.rstudio.com/t/rstudio-selected-code-to-snippet-updating-r-snippets-programmatically/20611

Is it possible to output a list of html pages names with handlebars?

Ok so I need to output a list of emails that were sent out. I'm using Zurb's Pannini(handlebars), but I'm not sure how to do it. Is it even possible?
I'm attaching an image of the file structure. The emails are in archive folder from the pages folder, and I need to write the handlebars code on the emails-table.html from the partials folder.
File Structure Screenshot
Thanks in advance.
I found your question as I was searching for a similar problem of iterating through pages to create "featured posts" for a home page.
I don't think that Foundation will do this natively. There is an {{#each XXX}}} construct in Handlebars/Panini that will iterate through YAML data.
You may be able to solve your particular issue by having your build process create a YAML array from the list of email filenames, store it in the data folder, and then use the {{#each}} technique to use that data to populate your emails-table.html table.

how to refresh image in codenameone(netbeans)

Im creating the UI of my application from a PSD file following the instructions in: https://www.codenameone.com/blog/psd-to-app-revisited.html (by using the css support plugin), everything is fine, but i edited one of the images in photoshop and exported it again to my codenameone folder(replacing the original image) and i thought the new image would replace the original one, but the application is still showing the old image(it seems as it is cached or something similar).
I already tried "Clean and build project" but didnt worked, also went to the generated .res file and tried to delete the original image but it says i must first delete the themes that use them(which i dont want to do). Is there any way to "refresh" the images referenced in the .res file so they reflect the latest image in the folder? or a "clear cache" or something similar. For now i renamed the image, and also changed the name in the css,but i think is not the best way cause that implies creating new names for your images, and editing your css with every little change.
If you change the image directly in the file system you need to do this when the designer is closed. Then reopen the designer res file and save it so the image is updated.

atom.io auto create html basic structure

Im using atom.io for some time now and really like it. there is just one thing im missing. I used to use brackets and sublime before and they both had a feature where you could create the basic structure of a html documents by just typing html.
this would just set the html, head and body tag. created the charset meta, title and link to css file.
I create a lot of html files a day so it would be really helpfull if I know the shortcode or the package which supports this!
You're looking for autocomplete-snippets.
Simply type html and press Enter
Here's a terrible GIF to prove it:
There is a nice Plugin, called emmet: https://atom.io/packages/emmet
When you got that, you just have to type ! -> tab in an empty document. You get pretty much the same result as #hatchet GIF.
If you have disabled the autocomplete functionality mentioned in the currently accepted answer, or want more flexibility than that allows, there is a file-templates package:
https://atom.io/packages/file-templates
Here are some basic instructions.
To install the package: edit->preferences->install->file-templates.
To save the template: packages->new template from this file.
To open a new file with that template, just hit ctrl-alt-n and
select it.
Make sure your file has .html added on the end of its name.
Then go back into Atom, type HTML, and press enter. Your boilerplate should appear. Solved my problem instantly!
If we install Emmet package we are not getting the boiler plate code. So I disabled emmet and it is working fine for me.
!tab is the command u seek. But it won't work unless you create a file and save it with the html extension...
So go create a new file in the directory u want, call it index.html and now go type !tab
It should work 100%, if not be sure u have emmet installed.

Resources