Skip to content

Instantly share code, notes, and snippets.

View sbalci's full-sized avatar
🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸

Serdar Balcı sbalci

🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸
View GitHub Profile
@hrbrmstr
hrbrmstr / webr-experiments.R
Created April 8, 2023 10:50
Janky R script to create the HTML page for https://rud.is/webr-experiments/
#!/usr/bin/env Rscript
library(httr, include.only = c("GET", "add_headers", "content"))
library(jsonlite, include.only = c("fromJSON", "write_json"))
library(glue, include.only = c("glue"))
GITHUB_TOKEN <- Sys.getenv("GITHUB_TOKEN")
JSON_FILE <- "webr-experiments.json"
HTML_FILE <- "webr-experiments/index.html"
@AlbertRapp
AlbertRapp / connected_ggiraph.R
Created January 25, 2023 19:39
connected_ggiraph.R
library(dplyr)
library(ggplot2)
library(patchwork)
library(ggiraph)
dat <- gapminder::gapminder |>
janitor::clean_names() |>
mutate(
# ID that is shared for boxplots (this one uses factors, i.e. numbers, as ID instead of continents)
@krlmlr
krlmlr / block.R
Created June 10, 2021 03:40
Block assigning to a variable more than once
`<-` <- function(lhs, rhs, envir = parent.frame()) {
assign(as.character(substitute(lhs)), rhs, envir)
lockBinding(substitute(lhs), envir)
invisible(rhs)
}
<?php
/**
* This recipe will redirect you to the levels page after registration
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_redirect_after_register( $user_id ){
@domenicrosati
domenicrosati / citations_to_retracted_by_journal.csv
Created October 29, 2020 18:51
Journal Citations to Retracted Articles Post Retraction
Journal Total Citations Citations to Retracted Articles Post Retraction % of citations to retracted articles
plos one 12783331 2959 0.02%
scientific reports 6295134 1227 0.02%
oncology letters 802286 898 0.11%
journal of biological chemistry 10712422 866 0.01%
biomed research international 1789456 806 0.05%
oncotarget 1353740 791 0.06%
international journal of molecular sciences 2380553 766 0.03%
proceedings of the national academy of sciences 9984417 704 0.01%
molecular medicine reports 754664 646 0.09%
@z3tt
z3tt / github.R
Last active April 20, 2024 17:00
Configure GitHub for Rstudio
#### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
#### 2. Install git ##########################################################
## If you do not have git installed, please do so:
@gausam
gausam / add-billing-to-add-member-and-profile.php
Created August 7, 2020 17:48
Add billing fields, with dropdown for country, to the Membership Profile page
<?php
/**
* This recipe adds billing fields to the Membership Profile page.
*
* It is intended for use with the Register Helper Add On:
* https://www.paidmembershipspro.com/add-ons/pmpro-register-helper-add-checkout-and-profile-fields/
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
@jasonsychau
jasonsychau / this_file_path.R
Last active July 2, 2023 01:35
R - get this file path
# a combination of
# https://stackoverflow.com/questions/1815606/determine-path-of-the-executing-script/15373917#15373917
# https://stackoverflow.com/questions/1815606/determine-path-of-the-executing-script/7585599#7585599
# https://stackoverflow.com/questions/47044068/get-the-path-of-current-script/47045368#47045368
# https://stackoverflow.com/questions/53512868/how-to-automatically-include-filepath-in-r-markdown-document/53516876#53516876
stub <- function() {}
thisPath <- function() {
cmdArgs <- commandArgs(trailingOnly = FALSE)
if (length(grep("^-f$", cmdArgs)) > 0) {
# R console option
library(tidyverse)

# Make yard size, the presence/absence of a home garden, and attitudes toward the 
# environment all correlated with each other. Home garden will be binary, so I split 
# it based on some threshold later. Attitudes toward the environment will be on a 
# scale of 1-10, so I rescale and ceiling it later

mu <- c(yard_size = 20000, home_garden = 30, attitude_env = 70)
stddev <- c(yard_size = 10000, home_garden = 15, attitude_env = 40)
@mkearney
mkearney / nevada-caucus-tweets-2020.R
Created February 22, 2020 22:12
Collect (via Twitter's stream API) tweets from 2020 Nevada Caucus
## load rtweet
library(rtweet)
## store bounding box coordinates for state of nevada
nv <- c(-120.00647, 35.00186, -114.03965, 42.00221)
## initialize output vector and Midwestern 'ope' counter
s <- list()
ope <- 0L