This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newif\ifglzcont | |
\def\glz{\glzconttrue\expandafter\glzi} | |
\def\glzi#1{\glzchar{#1}\ifglzcont\expandafter\glzi\else\expandafter\glzeat\fi} | |
\def\glzeat#1 {\textcolor{black!50}{#1}} | |
\def\glzchar#1{% | |
\if0#1\textcolor{black!20}{#1}\glzconttrue\else% | |
\if.#1.\glzconttrue\else% | |
#1\glzcontfalse% | |
\fi\fi} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List.Split | |
data Tabbed | |
= Tab [String] Tabbed Tabbed | |
| NoTab [String] Tabbed | |
| Nil | |
deriving (Show) | |
single [] = "" | |
single [str] = str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
template<class M, typename T> | |
class member_ptr | |
{ | |
size_t off_; | |
public: | |
member_ptr() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <cstdlib> | |
#include <iostream> | |
#include <iterator> | |
#include <algorithm> | |
#include <random> | |
#include <vector> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(scattermore) #from devtools::install_github('exaexa/scattermore') | |
library(ggplot2) | |
geom_scattermore <- function( | |
mapping=NULL, data=NULL, stat="identity", position="identity", ..., | |
na.rm=FALSE, show.legend = NA, inherit.aes = TRUE, interpolate = FALSE, pointsize = 0) { | |
layer( | |
data = data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
renderPageSelect <- function(pageId, pages) { | |
selectInput("pageId", label="Select a page", selected=pageId, choices=as.list(pages)) | |
} | |
renderMainPage <- function(pageId) { | |
res <- tagList() | |
if(pageId=='') res <- tagAppendChild(res, h3("No page selected")) | |
else res <- tagAppendChild(res, h3(paste0("The Page With Id ",pageId,"."))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################ | |
### CREATE EMBEDSOM PLOT ### | |
############################ | |
#you might need this: | |
#devtools::install_github('exaexa/EmbedSOM') | |
set.seed(1234) | |
# run FlowSOM (initial steps prior to meta-clustering) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EmbedContour <- function(e, bw=1, grid=c(201,201), | |
sub.ratio=.5, size.ratio=.5, cq=.666, add=T, ...) { | |
krnn <- KernSmooth::bkde2D(e,bandwidth=bw*sub.ratio,gridsize=grid) | |
krnw <- KernSmooth::bkde2D(e, bandwidth=bw, gridsize=grid, | |
range.x=list( | |
c(min(krnn$x1),max(krnn$x1)), | |
c(min(krnn$x2),max(krnn$x2)))) | |
con <- list(x=krnw$x1, y=krnw$x2, z=krnn$fhat-sub.ratio*krnw$fhat) | |
contour(con, add=add, drawlabels=F, levels=c(quantile(con$z, cq)), ...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExistentialQuantification #-} | |
data Code = forall a . Interpret a => Code {getCode :: a} | |
class Interpret a where | |
interpret :: a -> Int | |
pprint :: a -> String | |
instance Interpret Code where | |
interpret (Code a) = interpret a |