Skip to content

Instantly share code, notes, and snippets.

View jimhester's full-sized avatar

Jim Hester jimhester

View GitHub Profile

Git orphan branches & working trees

Creating an ophan branch

This command will create a branch with no parent (no commit history) on a repo.

git checkout --orphan <new-branch>

Managing working trees

Manage folders linked to others branches of your repo. Do not confuse them with git submodules which are links to different repositories.

@ledell
ledell / meetupr_rladies_budapest_random.R
Last active July 31, 2018 11:36
Randomly select an attendee of a meetup to win a prize! (R-Ladies Budapest Example)
# library(devtools)
# devtools::install_github("rladies/meetupr")
library(meetupr)
# Log in to meetup.com, your key is here: https://secure.meetup.com/meetup_api/key/
api_key <- "YOUR_API_KEY_HERE"
# `urlname` is a human-readable unique id for a meetup, e.g. https://www.meetup.com/R-Ladies-Budapest/
urlname <- "R-Ladies-Budapest"
@jmcphers
jmcphers / exceptionally-good-presentations.txt
Last active June 15, 2018 16:36
How to Give an Exceptionally Good Presentation
"HOW TO GIVE AN EXCEPTIONALLY GOOD PRESENTATION"
CHARACTERS
Joe Cheng.............Moderator
Jennifer Bryan........As Herself
Hadley Wickham........As Himself
Aron Atkins...........Audience
Derrick Kearney.......Audience
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
path <- "~/Documents/ingest/readxl/inst/extdata/datasets.xlsx"
zip_file <- function(path) {
stopifnot(file.exists(path))
path <- normalizePath(path)
contents <- utils::unzip(path, list = TRUE)
names(contents) <- c("path", "size", "date")
contents <- contents[contents$size > 0, , drop = FALSE]
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here

VIM FOR ADULTS

CHAPTER ONE: STOP TYPING

intro/stuff you should already know

what is vim?

  • based on very old editor (vi) designed in the days when connections were slow
  • installed on almost every *nix system, incl. os x
  • organic growth since to include hundreds of modern features
@gaborcsardi
gaborcsardi / cran-over-time.R
Last active July 18, 2020 19:21
Size of the CRAN R package repository over time
library(jsonlite)
## Download
pkgs <- fromJSON("http://crandb.r-pkg.org/-/events")
## Filter
na_pkgs <- unique(pkgs$name[ is.na(pkgs$date) ])
events <- pkgs[ ! pkgs$name %in% na_pkgs, c("date", "name", "event")]
@wch
wch / locale.R
Created December 18, 2015 15:31
Multibyte non-UTF-8 locales
# ==== Creating UTF-8 strings ====
# This is how to create a string with UTF-8 encoding. This should work
# regardless of the current locale settings.
x <- rawToChar(as.raw(c(0xe5, 0x8d, 0x88)))
Encoding(x) <- "UTF-8"
x
# [1] "午"
# Another string, 'Δ★😎'
pat <- rawToChar(as.raw(c(0xce, 0x94, 0xe2, 0x98, 0x85, 0xf0, 0x9f, 0x98, 0x8e)))
@jeroen
jeroen / encrypt.R
Last active January 14, 2016 14:01
Encrypt with github key
# Send Gabor an encrypted message
library(openssl)
library(jsonlite)
# Get Gabor's pubkey
keydata <- fromJSON("https://api.github.com/users/gaborcsardi/keys")
cat("Number of keys:", nrow(keydata), "\n")
pubkey <- read_pubkey(textConnection(keydata$key[1]))
print(pubkey)