Skip to content

Instantly share code, notes, and snippets.

@johnmyleswhite
Created February 4, 2014 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmyleswhite/8805059 to your computer and use it in GitHub Desktop.
Save johnmyleswhite/8805059 to your computer and use it in GitHub Desktop.
FTW
a <- 1
b <- 2
ftw <- function()
{
vars <- ls(envir = .GlobalEnv)
rm(list = vars, envir = .GlobalEnv)
}
ftw()
a
# Error: object 'a' not found
b
# Error: object 'b' not found
@hadley
Copy link

hadley commented Feb 4, 2014

run_once <- function() {
  message("This message will self-destruct in ")
  message("5...")
  Sys.sleep(1)
  message("4...")
  Sys.sleep(1)
  message("3...")
  Sys.sleep(1)
  message("2...")
  Sys.sleep(1)
  message("1...")
  Sys.sleep(1)
  rm(list = "run_once", envir = globalenv())
}
run_once()

@rasmusab
Copy link

rasmusab commented Feb 5, 2014

Now with sound...

library(devtools)
install_github("pingr", "rasmusab")
library(pingr)

run_once <- function() {
  message("This message will self-destruct in ")
  message("5...")
  Sys.sleep(1)
  message("4...")
  Sys.sleep(1)
  message("3...")
  Sys.sleep(1)
  message("2...")
  Sys.sleep(1)
  message("1...")
  Sys.sleep(1)
  rm(list = "run_once", envir = globalenv())
  ping(9)
}
run_once()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment