Skip to content

Instantly share code, notes, and snippets.

View alexpghayes's full-sized avatar

alex hayes alexpghayes

View GitHub Profile
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active March 11, 2025 21:24
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@stevenpollack
stevenpollack / !README.MD
Last active February 28, 2024 00:56
A simple R package development best-practices-example

R package development "best practices"

The core of this tutorial gist lies in bestPracticesWalkThrough.R. Running assumes you have the following packages at versions equal (or above) those specified

library('devtools') # 1.9.1
library('testthat') # 0.11.0
library('stringr')  # 1.0.0
library('git2r') # 0.12.1
#' ---
#' output:
#' html_document:
#' keep_md: TRUE
#' ---
#+ include = FALSE
library(dplyr)
#' Responses to [my
@jrnold
jrnold / gist:6799152
Last active August 18, 2021 13:44
Create a plot of the normal distribution with an area shaded in. Useful for teaching z-scores and stuff like that.
library("ggplot2")
#' Draw Normal Distribution Density with an area shaded in.
#'
#' @param lb Lower bound of the shaded area. Use \code{-Inf} for a left tail.
#' @param ub Upper bound of the shaded area. Use \code{Inf} for a right tail.
#' @param mean Mean of the normal distribution
#' @param sd Standard deviation of the normal distribution
#' @param limits Lower and upper bounds on the x-axis of the area displayed.
#' @return ggplot object.
@ntamas
ntamas / walker.py
Last active April 15, 2020 14:37
Weighted sampling with replacement using Walker's alias method - NumPy version
#!/usr/bin/env python
from numpy import arange, array, bincount, ndarray, ones, where
from numpy.random import seed, random, randint
__author__ = "Tamas Nepusz, Denis Bzowy"
__version__ = "27jul2011"
class WalkerRandomSampling(object):
"""Walker's alias method for random objects with different probablities.