Skip to content

Instantly share code, notes, and snippets.

Avatar

Miles McBain MilesMcBain

  • Queensland Fire and Emergency Services
  • Brisbane, Queensland
View GitHub Profile
View concat_maps.R
concat_maps <- function(...) {
rdeck_maps <- list(...)
rdeck_map_names <- names(rdeck_maps)
rdeck_map_names[nzchar(rdeck_map_names) == 0] <- "Base layers"
# set up init for reduce
container <- rdeck_maps[[1]]
container$x$layers <-
map(container$x$layers, function(layer) {
layer$group_name <- rdeck_map_names[[1]]
layer$visibility_toggle <- TRUE
@MilesMcBain
MilesMcBain / example.R
Created Mar 12, 2021
Prepare languageserver tcp client
View example.R
client <- TCPLanguageClient$new(port = 8888) #session 1
run(port = 8888) # session 2
client$start()
data <- client$fetch(blocking = TRUE)
client$handle_raw(data)
## do stuff with client
client %>% did_save(defn_file_path2)
result <- client %>% respond_document_symbol(defn_file_path2)
View crunchy.R
system.time({
library(conflicted)
library(qfes)
library(tidyverse)
library(rmapshaper)
library(sf)
library(h3jsr)
library(furrr)
library(future)
library(rdeck)
View gist:8441f0a418bb4e8c6df7785f054906dd
library(tidyverse)
oms_db <-
tribble( ~id, ~data, ~start, ~end,
1, 1, '2020-01-01', '2020-01-04',
1, 2, '2020-01-04', '3000-01-01',
2, 1, '2020-01-01', '2020-01-04',
2, 2, '2020-01-04', '3000-01-01',
View rmd_vignette.r
x <- vignette("dbplyr")
rstudioapi::navigateToFile(with(x, file.path(Dir, "doc", File)))
View bcdata_selection_Untitled-1
library(tidyverse)
first_year <- tibble(year = 2010, z = 1, x = 2, y = 3)
all_years <- first_year %>%
bind_rows(tibble(year = 2011:2015))
all_years %>%
summarise(
year = year,
View praise_be.R
some_praise <- quote(praise::praise())
praise_fn_code <- bquote(function() {
.(some_praise)
})
print(praise_fn_code)
#> function() {
#> praise::praise()
#> }
View aws_osrm_backend_instance.md

as per: aws_overpass_instance.md

  • docker
  • aws cli
    • aws credentials

get osrm australia data from s3

 aws s3 cp s3://pims-osrm-source-data/australia-latest.osm.bz2 ./australia-latest.osm.bz2
View addins.json
{
"fnmate::rs_fnmate": "Ctrl+Shift+F",
"drake::rs_addin_r_make": "Ctrl+M",
"drake::rs_addin_loadd": "Ctrl+L",
"shrtcts::shortcut_01": "Ctrl+P",
"shrtcts::shortcut_02": "Ctrl+O",
"shrtcts::shortcut_03": "Ctrl+T"
}
@MilesMcBain
MilesMcBain / nuked.txt
Created Jul 28, 2020
Blog links getting nuked (in order of tweeting)
View nuked.txt
https://milesmcbain.xyz/alt-r-with-vscode/
https://sharla.party/post/comparing-two-dfs/
https://themockup.blog/posts/2020-07-25-meta-rmarkdown/