Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rundel/livecode
https://github.com/rundel/livecode
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rundel/livecode
- Owner: rundel
- License: gpl-3.0
- Created: 2019-08-21T14:46:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T09:58:43.000Z (9 months ago)
- Last Synced: 2024-08-01T00:39:28.208Z (3 months ago)
- Language: CSS
- Size: 1.16 MB
- Stars: 118
- Watchers: 11
- Forks: 10
- Open Issues: 10
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
# livecode[![R build status](https://github.com/rundel/livecode/workflows/R-CMD-check/badge.svg)](https://github.com/rundel/livecode/actions?query=workflow%3AR-CMD-check)
![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)
livecode is an R package that enables you to broadcast a local R (or any other text) document over the web and provide live updates as it is edited.
![](man/figures/livecode.png)
## Installation
You can install the development version of `livecode` from this GitHub repository:
``` r
remotes::install_github("rundel/livecode")
```## Usage
``` r
# From RStudio with an open R script
server = livecode::serve_file()
#> ✔ Started sharing 'example.R' at 'http://192.168.1.128:30000'.
#> ✖ The current ip address ('192.168.1.128') for the server is private, only users on the same local network are likely to be able to connect.# Once started, send messages to your users.
server$send_msg("Hello World!", type = "success")
server$send_msg("Oh no!\n\n Something bad has happened.", type = "error")# Once finished, shut the server down.
server$stop()
#> ✔ Stopped server at 'http://192.168.1.128:30000'.
```## Using bitly
`livecode` has built in functionality for generating a bitlink automatically for your livecoding session. To do this you will need to provide `livecode` with a bitly API access token. To obtain one of these tokens you will need to create an account with bitly (the free tier is sufficient) and then select Profile Settings > Generic Access Token and then enter your password when prompted. This results in a long hexidecimal string that you should copy to your clipboard.
`livecode` looks for this token in an environmental variable called `BITLY_PAT`. To properly configure this environmental variable we can use the `usethis` package. In R run the following,
```r
usethis::edit_r_environ()
```which will open your `.Renviron` file for you and you will just need to add a single line with the format
```
BITLY_PAT=0123456789abcdef0123456789abcdef01234567
```replacing `0123456789abcdef0123456789abcdef01234567` with the hexidecimal string you copied from bitly. After saving `.Renviron` you will need to restart your R session and can then test that your token is function correctly by running,
```r
livecode::bitly_test_token()
#> ✔ Your bitly token is functioning correctly.
```