2
2
=======
3
3
4
4
5
+
5
6
[ ![ cran checks] ( https://cranchecks.info/badges/worst/gistr )] ( https://cranchecks.info/pkgs/gistr )
6
7
[ ![ Build Status] ( https://api.travis-ci.org/ropensci/gistr.png )] ( https://travis-ci.org/ropensci/gistr )
7
8
[ ![ Build status] ( https://ci.appveyor.com/api/projects/status/4jmuxbbv8qg4139t/branch/master?svg=true )] ( https://ci.appveyor.com/project/sckott/gistr/branch/master )
8
9
[ ![ codecov.io] ( https://codecov.io/github/ropensci/gistr/coverage.svg?branch=master )] ( https://codecov.io/github/ropensci/gistr?branch=master )
9
- [ ![ rstudio mirror downloads] ( http ://cranlogs.r-pkg.org/badges/gistr)] ( https://github.com/metacran/cranlogs.app )
10
- [ ![ cran version] ( http ://www.r-pkg.org/badges/version/gistr)] ( https://cran.r-project.org/package=gistr )
10
+ [ ![ rstudio mirror downloads] ( https ://cranlogs.r-pkg.org/badges/gistr)] ( https://github.com/metacran/cranlogs.app )
11
+ [ ![ cran version] ( https ://www.r-pkg.org/badges/version/gistr)] ( https://cran.r-project.org/package=gistr )
11
12
12
13
` gistr ` is a light interface to GitHub's gists for R.
13
14
14
15
## See also:
15
16
16
17
* [ rgithub] ( https://github.com/cscheid/rgithub ) an R client for the Github API by Carlos Scheidegger
17
18
* [ git2r] ( https://github.com/ropensci/git2r ) an R client for the libgit2 C library by Stefan Widgren
19
+ * [ gert] ( https://github.com/r-lib/gert ) Simple git client for R by Jeroen Ooms
18
20
* [ gistfo] ( https://github.com/MilesMcBain/gistfo ) for turning your untitled RStudio tabs into gists!
19
21
20
22
## Quick start
@@ -44,7 +46,7 @@ library("gistr")
44
46
45
47
There are two ways to authorise gistr to work with your GitHub account:
46
48
47
- * Generate a personal access token (PAT) at [ https://help.github.com/articles/creating-an-access-token-for-command-line-use ] ( https://help.github.com/articles/creating-an-access-token-for-command-line-use ) and record it in the ` GITHUB_PAT ` environment variable.
49
+ * Generate a personal access token (PAT) ** with the gist scope selected ** at [ https://help.github.com/articles/creating-an-access-token-for-command-line-use ] ( https://help.github.com/articles/creating-an-access-token-for-command-line-use ) and record it in the ` GITHUB_PAT ` environment variable.
48
50
- To test out this approach, execute this in R: ` Sys.setenv(GITHUB_PAT = "blahblahblah") ` , where "blahblahblah" is the PAT you got from GitHub. Then take ` gistr ` out for a test drive.
49
51
- If that works, you will probably want to define the GITHUB_PAT environment variable in a file such as ` ~/.bash_profile ` or ` ~/.Renviron ` .
50
52
* Interactively login into your GitHub account and authorise with OAuth.
@@ -94,8 +96,8 @@ update(add_files(gists(what = "minepublic")[[1]], file))
94
96
``` r
95
97
rate_limit()
96
98
# > Rate limit: 5000
97
- # > Remaining: 4975
98
- # > Resets in: 56 minutes
99
+ # > Remaining: 4897
100
+ # > Resets in: 55 minutes
99
101
```
100
102
101
103
### List gists
@@ -106,21 +108,21 @@ Limiting to a few results here to keep it brief
106
108
``` r
107
109
gists(per_page = 2 )
108
110
# > [[1]]
109
- # > <gist>6ac700bec42f7563bf809d8d92ae4906
110
- # > URL: https://gist.github.com/6ac700bec42f7563bf809d8d92ae4906
111
- # > Description: Password Dictionary for Brute force attack
111
+ # > <gist>d78aa1e84304254cda4629f7b5673d40
112
+ # > URL: https://gist.github.com/d78aa1e84304254cda4629f7b5673d40
113
+ # > Description:
112
114
# > Public: TRUE
113
- # > Created/Edited: 2018-04-16T21:25:21Z / 2018-04-16T21:25:22Z
114
- # > Files: dictionary.txt
115
+ # > Created/Edited: 2020-01-08T17:03:11Z / 2020-01-08T17:03:12Z
116
+ # > Files: handsontable.full.min.js
115
117
# > Truncated?: FALSE
116
118
# >
117
119
# > [[2]]
118
- # > <gist>89df33d7a21ed92d2fad5c4cec96f8ae
119
- # > URL: https://gist.github.com/89df33d7a21ed92d2fad5c4cec96f8ae
120
- # > Description: Export documents to a zip file
120
+ # > <gist>f53546b3fd60a306da6c5068726c5f53
121
+ # > URL: https://gist.github.com/f53546b3fd60a306da6c5068726c5f53
122
+ # > Description: 17_webhook.js
121
123
# > Public: TRUE
122
- # > Created/Edited: 2018-04-16T21:25:03Z / 2018-04-16T21:25:04Z
123
- # > Files: export_zip.xqy
124
+ # > Created/Edited: 2020-01-08T17:02:55Z / 2020-01-08T17:02:55Z
125
+ # > Files: 17_webhook.js
124
126
# > Truncated?: FALSE
125
127
```
126
128
@@ -130,21 +132,21 @@ Since a certain date/time
130
132
``` r
131
133
gists(since = ' 2014-05-26T00:00:00Z' , per_page = 2 )
132
134
# > [[1]]
133
- # > <gist>6ac700bec42f7563bf809d8d92ae4906
134
- # > URL: https://gist.github.com/6ac700bec42f7563bf809d8d92ae4906
135
- # > Description: Password Dictionary for Brute force attack
135
+ # > <gist>d78aa1e84304254cda4629f7b5673d40
136
+ # > URL: https://gist.github.com/d78aa1e84304254cda4629f7b5673d40
137
+ # > Description:
136
138
# > Public: TRUE
137
- # > Created/Edited: 2018-04-16T21:25:21Z / 2018-04-16T21:25:22Z
138
- # > Files: dictionary.txt
139
+ # > Created/Edited: 2020-01-08T17:03:11Z / 2020-01-08T17:03:12Z
140
+ # > Files: handsontable.full.min.js
139
141
# > Truncated?: FALSE
140
142
# >
141
143
# > [[2]]
142
- # > <gist>89df33d7a21ed92d2fad5c4cec96f8ae
143
- # > URL: https://gist.github.com/89df33d7a21ed92d2fad5c4cec96f8ae
144
- # > Description: Export documents to a zip file
144
+ # > <gist>f53546b3fd60a306da6c5068726c5f53
145
+ # > URL: https://gist.github.com/f53546b3fd60a306da6c5068726c5f53
146
+ # > Description: 17_webhook.js
145
147
# > Public: TRUE
146
- # > Created/Edited: 2018-04-16T21:25:03Z / 2018-04-16T21:25:04Z
147
- # > Files: export_zip.xqy
148
+ # > Created/Edited: 2020-01-08T17:02:55Z / 2020-01-08T17:02:55Z
149
+ # > Files: 17_webhook.js
148
150
# > Truncated?: FALSE
149
151
```
150
152
@@ -154,21 +156,21 @@ Request different types of gists, one of public, minepublic, mineall, or starred
154
156
``` r
155
157
gists(' minepublic' , per_page = 2 )
156
158
# > [[1]]
157
- # > <gist>d6c06c121e70016e1caf159c7d7b6aa6
158
- # > URL: https://gist.github.com/d6c06c121e70016e1caf159c7d7b6aa6
159
- # > Description:
159
+ # > <gist>7b8f60796af0588dfc73576d865e0661
160
+ # > URL: https://gist.github.com/7b8f60796af0588dfc73576d865e0661
161
+ # > Description: gist gist gist
160
162
# > Public: TRUE
161
- # > Created/Edited: 2018-04-16T21:24:47Z / 2018-04-16T21:24:55Z
162
- # > Files: code.R
163
- # > Truncated?: FALSE
163
+ # > Created/Edited: 2020-01-08T17:00:22Z / 2020-01-08T17:00:23Z
164
+ # > Files: stuff.md, zoo.json
165
+ # > Truncated?: FALSE, FALSE
164
166
# >
165
167
# > [[2]]
166
- # > <gist>f271bcf55ad2e17c34f4e99e2458d232
167
- # > URL: https://gist.github.com/f271bcf55ad2e17c34f4e99e2458d232
168
- # > Description: a new cool gist
168
+ # > <gist>c7615e91cc895073cd4797f3611d2e76
169
+ # > URL: https://gist.github.com/c7615e91cc895073cd4797f3611d2e76
170
+ # > Description:
169
171
# > Public: TRUE
170
- # > Created/Edited: 2018-04-16T21:24:46Z / 2018-04-16T21:24:46Z
171
- # > Files: stuff.md
172
+ # > Created/Edited: 2019-12-09T17:08:30Z / 2019-12-09T17:08:30Z
173
+ # > Files: pleiades4d094996f27f.geojson
172
174
# > Truncated?: FALSE
173
175
```
174
176
@@ -195,11 +197,11 @@ You can pass in files
195
197
``` r
196
198
file <- system.file(" examples" , " stuff.md" , package = " gistr" )
197
199
gist_create(file , description = ' a new cool gist' , browse = FALSE )
198
- # > <gist>7563b7654b15a8c4cc9f69880ae78d18
199
- # > URL: https://gist.github.com/7563b7654b15a8c4cc9f69880ae78d18
200
+ # > <gist>073c7097bb0cad5722ebc13f1c37e4f8
201
+ # > URL: https://gist.github.com/073c7097bb0cad5722ebc13f1c37e4f8
200
202
# > Description: a new cool gist
201
203
# > Public: TRUE
202
- # > Created/Edited: 2018-04-16T21:25:58Z / 2018-04-16T21:25:58Z
204
+ # > Created/Edited: 2020-01-08T17:03:26Z / 2020-01-08T17:03:26Z
203
205
# > Files: stuff.md
204
206
# > Truncated?: FALSE
205
207
```
@@ -226,11 +228,11 @@ numbers
226
228
227
229
[1] 0.3229318 0.5933054 0.7778408 0.3898947 0.1309717 0.7501378 0.3206379 0.3379005
228
230
' }, browse = FALSE )
229
- # > <gist>b7f90fcb99dae005db9d837f1a21ee03
230
- # > URL: https://gist.github.com/b7f90fcb99dae005db9d837f1a21ee03
231
+ # > <gist>b3da1493d09ba15a5d9695b428219601
232
+ # > URL: https://gist.github.com/b3da1493d09ba15a5d9695b428219601
231
233
# > Description:
232
234
# > Public: TRUE
233
- # > Created/Edited: 2018-04-16T21:26:00Z / 2018-04-16T21:26:00Z
235
+ # > Created/Edited: 2020-01-08T17:03:28Z / 2020-01-08T17:03:28Z
234
236
# > Files: code.R
235
237
# > Truncated?: FALSE
236
238
```
@@ -275,11 +277,11 @@ knit a local file
275
277
``` r
276
278
file <- system.file(" examples" , " stuff.Rmd" , package = " gistr" )
277
279
run(file , knitopts = list (quiet = TRUE )) %> % gist_create(browse = FALSE )
278
- # > <gist>5f05cf24cf459e0818ae2e128c14f301
279
- # > URL: https://gist.github.com/5f05cf24cf459e0818ae2e128c14f301
280
+ # > <gist>cc76dd026ff004b2bc1ec5591d7528e8
281
+ # > URL: https://gist.github.com/cc76dd026ff004b2bc1ec5591d7528e8
280
282
# > Description:
281
283
# > Public: TRUE
282
- # > Created/Edited: 2018-04-16T21:26:01Z / 2018-04-16T21:26:01Z
284
+ # > Created/Edited: 2020-01-08T17:03:30Z / 2020-01-08T17:03:30Z
283
285
# > Files: stuff.md
284
286
# > Truncated?: FALSE
285
287
```
@@ -344,9 +346,9 @@ gist_create(file, knit=TRUE, imgur_inject = TRUE)
344
346
gists()[[1 ]] %> % commits()
345
347
# > [[1]]
346
348
# > <commit>
347
- # > Version: bf6f7fcb219bed1ac3de465f707d17d344da4c22
349
+ # > Version: 06e379abc23086722593c7026f8a169991bb9791
348
350
# > User: sckott
349
- # > Commited: 2018-04-16T21:25:59Z
351
+ # > Commited: 2020-01-08T17:03:27Z
350
352
# > Commits [total, additions, deletions]: [5,5,0]
351
353
```
352
354
@@ -368,6 +370,7 @@ gist('cbb0507082bb18ff7e4b') %>% star()
368
370
369
371
Unstar
370
372
373
+
371
374
``` r
372
375
gist(' cbb0507082bb18ff7e4b' ) %> % unstar()
373
376
# > <gist>cbb0507082bb18ff7e4b
@@ -389,11 +392,11 @@ file <- system.file("examples", "alm.md", package = "gistr")
389
392
gists(what = " minepublic" )[[1 ]] %> %
390
393
add_files(file ) %> %
391
394
update()
392
- # > <gist>b7f90fcb99dae005db9d837f1a21ee03
393
- # > URL: https://gist.github.com/b7f90fcb99dae005db9d837f1a21ee03
395
+ # > <gist>b3da1493d09ba15a5d9695b428219601
396
+ # > URL: https://gist.github.com/b3da1493d09ba15a5d9695b428219601
394
397
# > Description:
395
398
# > Public: TRUE
396
- # > Created/Edited: 2018-04-16T21:26:00Z / 2018-04-16T21:26:25Z
399
+ # > Created/Edited: 2020-01-08T17:03:28Z / 2020-01-08T17:03:34Z
397
400
# > Files: alm.md, code.R
398
401
# > Truncated?: FALSE, FALSE
399
402
```
@@ -406,11 +409,11 @@ file <- system.file("examples", "alm.md", package = "gistr")
406
409
gists(what = " minepublic" )[[1 ]] %> %
407
410
delete_files(file ) %> %
408
411
update()
409
- # > <gist>b7f90fcb99dae005db9d837f1a21ee03
410
- # > URL: https://gist.github.com/b7f90fcb99dae005db9d837f1a21ee03
412
+ # > <gist>b3da1493d09ba15a5d9695b428219601
413
+ # > URL: https://gist.github.com/b3da1493d09ba15a5d9695b428219601
411
414
# > Description:
412
415
# > Public: TRUE
413
- # > Created/Edited: 2018-04-16T21:26:00Z / 2018-04-16T21:26:26Z
416
+ # > Created/Edited: 2020-01-08T17:03:28Z / 2020-01-08T17:03:36Z
414
417
# > Files: code.R
415
418
# > Truncated?: FALSE
416
419
```
@@ -429,7 +432,7 @@ gists()[[1]] %>% browse()
429
432
430
433
``` r
431
434
gists()[[1 ]] %> % embed()
432
- # > [1] "<script src=\"https://gist.github.com/sckott/b7f90fcb99dae005db9d837f1a21ee03 .js\"></script>"
435
+ # > [1] "<script src=\"https://gist.github.com/sckott/b3da1493d09ba15a5d9695b428219601 .js\"></script>"
433
436
```
434
437
435
438
### List forks
@@ -444,7 +447,7 @@ gist(id='1642874') %>% forks(per_page=2)
444
447
# > URL: https://gist.github.com/1642989
445
448
# > Description: Spline Transition
446
449
# > Public: TRUE
447
- # > Created/Edited: 2012-01-19T21:45:20Z / 2018-02-07T07:49:17Z
450
+ # > Created/Edited: 2012-01-19T21:45:20Z / 2019-10-23T20:09:07Z
448
451
# > Files:
449
452
# > Truncated?:
450
453
# >
@@ -453,7 +456,7 @@ gist(id='1642874') %>% forks(per_page=2)
453
456
# > URL: https://gist.github.com/1643051
454
457
# > Description: Line Transition (Broken)
455
458
# > Public: TRUE
456
- # > Created/Edited: 2012-01-19T21:51:30Z / 2016-12-01T07:19:06Z
459
+ # > Created/Edited: 2012-01-19T21:51:30Z / 2019-10-23T20:08:44Z
457
460
# > Files:
458
461
# > Truncated?:
459
462
```
@@ -466,12 +469,12 @@ Returns a `gist` object
466
469
``` r
467
470
g <- gists()
468
471
(forked <- g [[ sample(seq_along(g ), 1 ) ]] %> % fork())
469
- # > <gist>ca541fdae95e8a2e009bea872595bd2b
470
- # > URL: https://gist.github.com/ca541fdae95e8a2e009bea872595bd2b
471
- # > Description:
472
+ # > <gist>2052cabf87af7facf353df7fe0d83ab8
473
+ # > URL: https://gist.github.com/2052cabf87af7facf353df7fe0d83ab8
474
+ # > Description: Fetch company details with theirs posts & comments
472
475
# > Public: TRUE
473
- # > Created/Edited: 2018-04-16T21:26:33Z / 2018-04-16T21:26:33Z
474
- # > Files: .py
476
+ # > Created/Edited: 2020-01-08T17:03:42Z / 2020-01-08T17:03:42Z
477
+ # > Files: company.js
475
478
# > Truncated?: FALSE
476
479
```
477
480
0 commit comments