This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ./encrypt.rb | |
# 1. Get an array of all the letters of the alphabet | |
# See: https://ruby-doc.org/core-3.0.2/Range.html | |
LETTERS = ("A".."Z").to_a | |
# Alternatively: | |
# LETTERS = Array ("A".."Z") | |
def encrypt(text, offset = -3) | |
# Parameter checking: ------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Utils | |
e_header() { | |
printf "\n$(tput setaf 3)%s$(tput sgr0)\n" "$@" | |
sleep 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/test/mailers/previews/devise_mailer_preview.rb | |
class DeviseMailerPreview < ActionMailer::Preview | |
def confirmation_instructions | |
Devise::Mailer.confirmation_instructions(User.first, {}) | |
end | |
def unlock_instructions | |
Devise::Mailer.unlock_instructions(User.first, "faketoken") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(googlesheets4) | |
library(sf) | |
us <- | |
rnaturalearth::ne_states(returnclass = "sf") %>% | |
filter(iso_a2 == "US" & !iso_3166_2 %in% c("US-HI", "US-AK")) %>% | |
sf::st_transform(102003) | |
monuments <- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## A short function which is effectively a wrapper around lapply, where the function is reattempted on failure | |
## a set number of times | |
repply <- function(X, FUN, ..., .max_retry = 3) { | |
init <- lapply(X, function(x) try(FUN(x), silent = TRUE), ...) | |
n <- 1 | |
while(n <= .max_retry) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
url <- "ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/monthly/shapefiles/shp_extent/12_Dec/extent_N_201012_polygon_v3.0.zip" | |
tempdir <- tempdir(check = TRUE) | |
tempfile <- tempfile() | |
download.file(url, tempfile, mode = "wb") |