Skip to content

Instantly share code, notes, and snippets.

@rabdill
rabdill / raytrace_photos.r
Last active May 27, 2020 17:46
Turn a bitmap into an unsettling 3D map
# Inspired by this twitter thread:
# https://twitter.com/tylermorganwall/status/1088978382195437568
# Using (and borrowing code from) the immaculate documentation here:
# https://github.com/clauswilke/isoband
# https://github.com/tylermorganwall/rayshader
# Just provide a URL to the image you want to make weird; everything else should work out of the box:
image_url = "https://pbs.twimg.com/profile_images/905186381995147264/7zKAG5sY_400x400.jpg"
resolution = "200x200" # 200x200 seems manageable here; this is the factor that will increase computation time
@mtmorgan
mtmorgan / readKallisto.R
Last active December 4, 2017 11:51
read kallisto RNA-seq quantification into R / Bioconductor data structures
.require <-
function(pkg)
{
withCallingHandlers({
suppressPackageStartupMessages({
require(pkg, character.only=TRUE, quietly=TRUE)
})
}, warning=function(w) {
invokeRestart("muffleWarning")
}) || {
/**
* Original source:
* [[https://gist.github.com/oxbowlakes/970717]]
*
* Modifications:
* - use scala 7.0.5
* - use toValidationNel
* - use sequenceU and traverseU instead of the lambda trick
*
* Part Zero : 10:15 Saturday Night
@rasmusab
rasmusab / significance_test.R
Last active June 10, 2020 21:01
A Significantly Improved Significance Test! Not! (More context in this blogpost: http://www.sumsar.net/blog/2014/02/a-significantly-improved-test/)
# Test of Significance, takes the same arguments as t.test() .
signif.test <- function(x, ...) {
p <- t.test(x, ...)$p.value
# List of p excuses retrieved from http://mchankins.wordpress.com/2013/04/21/still-not-significant-2/
p_excuses <- c(
"(barely) not statistically significant <p>",
"a barely detectable statistically significant difference <p>",
"a borderline significant trend <p>",
"a certain trend toward significance <p>",
@retronym
retronym / config.scala
Last active May 9, 2018 05:47
Styles of config propagation: Manual, Implicits, DynamicVariable, Reader
package scalaz.example
object Reader extends App {
/**
* Manual propagation of the environment (in the example, `contextRoot`.)
*/
object Config0 {
def fragment1(contextRoot: String) = <a href={contextRoot + "/foo"}>foo</a>
@viktorklang
viktorklang / CQRS_ES_Actor.scala
Created February 1, 2011 15:05
CQRS and EventSourcing using Akka Actors
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {