Skip to content

Instantly share code, notes, and snippets.

View jobreu's full-sized avatar

Johannes Breuer jobreu

View GitHub Profile
@favstats
favstats / collapseoutput.js
Last active July 13, 2021 09:40 — forked from emitanaka/collapseoutput.js
Collapsible Code Output for `xaringan`
<script>
(function() {
var divHTML = document.querySelectorAll(".details-open");
divHTML.forEach(function (el) {
var preNodes = el.getElementsByTagName("pre");
var outputNode = preNodes[1];
outputNode.outerHTML = "<details open class='output'><summary>Run</summary>" + outputNode.outerHTML + "</details>";
})
})();
(function() {
@schochastics
schochastics / get_tweets.R
Last active September 22, 2021 08:40
Get tweets from the Academic Research product track.
# start_time: %Y-%m-%dT%H:%M:%SZ
# end_time: %Y-%m-%dT%H:%M:%SZ
# needs jsonlite and httr
# next_token can be obtained from meta$next_token to paginate through results
get_tweets <- function(q="",n=10,start_time,end_time,token,next_token=""){
if(n>500){
warning("n too big. Using 500 instead")
n <- 500
}
if(n<5){
@Kudusch
Kudusch / twitter_functions_v2.py
Created February 5, 2021 13:54
Python functions for the Twitter API v2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import datetime
import math
import csv
import json
import traceback
import time
@gadenbuie
gadenbuie / xaringan-chromote-print.R
Last active November 16, 2023 16:49
Print xaringan slides to PDF, even the complicated ones
#' Print xaringan slides to PDF
#'
#' Prints xaringan slides to a PDF file, even complicated slides
#' with panelsets or other html widgets or advanced features.
#' Requires a local installation of Chrome.
#'
#' @param input Path to Rmd or html file of xaringan slides.
#' @param output_file The name of the output file. If using NULL then
#' the output filename will be based on filename for the input file.
#' If a filename is provided, a path to the output file can also be provided.