text:
package com.koushikdutta.async;

import com.koushikdutta.async.callback.CompletedCallback;
import com.koushikdutta.async.callback.DataCallback;

/**
 * Created by koush on 5/27/13.
 */
public abstract class DataEmitterBase implements DataEmitter {
    private boolean ended;
    protected void report(Exception e) {
        if (ended)
            return;
        ended = true;
        if (getEndCallback() != null)
            getEndCallback().onCompleted(e);
    }

    @Override
    public final void setEndCallback(CompletedCallback callback) {
        endCallback = callback;
    }

    CompletedCallback endCallback;
    @Override
    public final CompletedCallback getEndCallback() {
        return endCallback;
    }

    DataCallback mDataCallback;
    @Override
    public void setDataCallback(DataCallback callback) {
        mDataCallback = callback;
    }

    @Override
    public DataCallback getDataCallback() {
        return mDataCallback;
    }

    @Override
    public String charset() {
        return null;
    }
}


text:
prog = ARGV[0]
current_dir = ARGV[1]
Dir.chdir current_dir
dir = 'tmp'
Dir.mkdir dir unless Dir.exists? dir
temp_file = "./tmp/last_output"
divider =  "--------------------------------------------------"
files = Dir["./tests/*.in"]
total = files.size
succeded = 0
failed = 0

puts <<START
Running tests for
#{current_dir}
#{divider}
START
files.each.with_index do |file,i|
  `./#{prog} < #{file} > #{temp_file}`
  out_file = file.split('.')[0..-2].join(".")+".out"
  input = File.open(file).read
  expected = File.open(out_file).read
  got = File.open(temp_file).read
  print "#{i+1}) "
  if (got == expected)
    succeded += 1
    puts "OK"
  else
    failed += 1
    puts <<ERROR
Got error:
On input:
#{input}
  expected:
#{expected}
  but got:
#{got}
ERROR
  end
  puts divider
end

puts <<RES
Results:
total: #{total}
succeded: #{succeded}
failed: #{failed}
RES
if failed == 0
  puts "All tests passed successfully!"
else
  puts "GOT SOME ERRORS!"
end

redpajama_set_name: RedPajamaGithub


text:
.class abstract Lcom/android/server/WifiService$DeathRecipient;
.super Ljava/lang/Object;
.source "WifiService.java"

# interfaces
.implements Landroid/os/IBinder$DeathRecipient;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/WifiService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x402
    name = "DeathRecipient"
.end annotation

# instance fields
.field mBinder:Landroid/os/IBinder;

.field mMode:I

.field mTag:Ljava/lang/String;

.field mWorkSource:Landroid/os/WorkSource;

.field final synthetic this$0:Lcom/android/server/WifiService;

# direct methods
.method constructor <init>(Lcom/android/server/WifiService;ILjava/lang/String;Landroid/os/IBinder;Landroid/os/WorkSource;)V
    .locals 3
    .parameter
    .parameter "mode"
    .parameter "tag"
    .parameter "binder"
    .parameter "ws"

    .prologue
    .line 1586
    iput-object p1, p0, Lcom/android/server/WifiService$DeathRecipient;->this$0:Lcom/android/server/WifiService;

    .line 1587
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 1588
    iput-object p3, p0, Lcom/android/server/WifiService$DeathRecipient;->mTag:Ljava/lang/String;

    .line 1589
    iput p2, p0, Lcom/android/server/WifiService$DeathRecipient;->mMode:I

    .line 1590
    iput-object p4, p0, Lcom/android/server/WifiService$DeathRecipient;->mBinder:Landroid/os/IBinder;

    .line 1591
    iput-object p5, p0, Lcom/android/server/WifiService$DeathRecipient;->mWorkSource:Landroid/os/WorkSource;

    .line 1593
    :try_start_0
    iget-object v1, p0, Lcom/android/server/WifiService$DeathRecipient;->mBinder:Landroid/os/IBinder;

    const/4 v2, 0x0

    invoke-interface {v1, p0, v2}, Landroid/os/IBinder;->linkToDeath(Landroid/os/IBinder$DeathRecipient;I)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 1597
    :goto_0
    return-void

    .line 1594
    :catch_0
    move-exception v0

    .line 1595
    .local v0, e:Landroid/os/RemoteException;
    invoke-virtual {p0}, Lcom/android/server/WifiService$DeathRecipient;->binderDied()V

    goto :goto_0
.end method

# virtual methods
.method unlinkDeathRecipient()V
    .locals 2

    .prologue
    .line 1600
    iget-object v0, p0, Lcom/android/server/WifiService$DeathRecipient;->mBinder:Landroid/os/IBinder;

    const/4 v1, 0x0

    invoke-interface {v0, p0, v1}, Landroid/os/IBinder;->unlinkToDeath(Landroid/os/IBinder$DeathRecipient;I)Z

    .line 1601
    return-void
.end method


text:
"""
Created on 10 Jul 2016

@author: Bruno Beloff (bruno.beloff@southcoastscience.com)

Analog Front-End (AFE)

Warning: If an Ox sensor is present, the NO2 sensor must have a lower sensor number (SN) than the Ox sensor,
otherwise the NO2 cross-sensitivity concentration will not be found.
"""

import time

from scs_core.data.str import Str

from scs_core.gas.afe.afe_datum import AFEDatum

from scs_dfe.gas.afe.ads1115 import ADS1115
from scs_dfe.gas.afe.mcp342x import MCP342X

from scs_dfe.gas.gas_sensor_interface import GasSensorInterface

# --------------------------------------------------------------------------------------------------------------------

class AFE(GasSensorInterface):
    """
    Alphasense Analogue Front-End (AFE) with Ti ADS1115 ADC (gases), Microchip Technology MCP342X ADC (Pt1000 temp)
    """

    __SRC = 'AFE'               # Alphasense analogue front end

    @classmethod
    def src(cls):
        return cls.__SRC

    # ----------------------------------------------------------------------------------------------------------------

    __RATE = ADS1115.RATE_8
    __MUX = (ADS1115.MUX_A3_GND, ADS1115.MUX_A2_GND, ADS1115.MUX_A1_GND, ADS1115.MUX_A0_GND)

    # ----------------------------------------------------------------------------------------------------------------

    @classmethod
    def __no2_sample(cls, samples):
        for sample in samples:
            if sample[0] == 'NO2':
                return sample[1]

        return None

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, interface, pt1000, sensors):
        """
        Constructor
        """
        self.__pt1000 = pt1000
        self.__sensors = sensors

        self.__wrk_adc = ADS1115(ADS1115.ADDR_WRK, AFE.__RATE)
        self.__aux_adc = ADS1115(ADS1115.ADDR_AUX, AFE.__RATE)

        self.__pt1000_adc = None if pt1000 is None else interface.pt1000_adc(MCP342X.GAIN_4, MCP342X.RATE_15)

        self.__tconv = self.__wrk_adc.tconv

    # ----------------------------------------------------------------------------------------------------------------
    # business methods...

    def adc_versions(self):
        return ('ADS1115', )

    def sample(self, sht_datum=None):
        # temperature...
        pt1000_datum = self.sample_pt1000()
        temp = self.sample_temp(sht_datum)

        # gases...
        samples = []
        no2_sample = None

        for sensor_index in range(len(self.__sensors)):
            sensor = self.__sensors[sensor_index]

            if sensor is None:
                continue

            # cross-sensitivity sample...
            if sensor.has_no2_cross_sensitivity():
                no2_sample = AFE.__no2_sample(samples)

            # sample...
            sample = sensor.sample(self, temp, sensor_index, no2_sample)

            samples.append((sensor.gas_name, sample))

        return AFEDatum(pt1000_datum, *samples)

    def sample_station(self, sn, sht_datum=None):
        # temperature...
        pt1000_datum = self.sample_pt1000()
        temp = self.sample_temp(sht_datum)

        # gas...
        index = sn - 1

        sensor = self.__sensors[index]

        if sensor is None:
            return AFEDatum(pt1000_datum)

        # cross-sensitivity sample...
        if sensor.has_no2_cross_sensitivity():
            no2_index, no2_sensor = self.__no2_sensor()
            no2_sample = no2_sensor.sample(self, temp, no2_index)
        else:
            no2_sample = None

        # sample...
        sample = sensor.sample(self, temp, index, no2_sample)

        return AFEDatum(pt1000_datum, (sensor.gas_name, sample))

    def null_datum(self):
        pt1000_datum = self.sample_pt1000()

        samples = []

        for sensor_index in range(len(self.__sensors)):
            sensor = self.__sensors[sensor_index]

            if sensor is None:
                continue

            samples.append((sensor.gas_name, sensor.null_datum()))

        return AFEDatum(pt1000_datum, *samples)

    def sample_temp(self, sht_datum):
        if sht_datum is not None:
            return sht_datum.temp

        pt1000_datum = self.sample_pt1000()

        return None if pt1000_datum is None else pt1000_datum.temp

    def sample_pt1000(self):
        if self.__pt1000 is None:
            return None

        try:
            return self.__pt1000.sample(self)

        except OSError:
            return self.__pt1000.null_datum()

    # ----------------------------------------------------------------------------------------------------------------
    # electrochem callbacks...

    def sample_raw_wrk_aux(self, sensor_index, gain_index):
        try:
            gain = ADS1115.gain(gain_index)

            mux = AFE.__MUX[sensor_index]

            self.__wrk_adc.start_conversion(mux, gain)
            self.__aux_adc.start_conversion(mux, gain)

            time.sleep(self.__tconv)

            we_v = self.__wrk_adc.read_conversion()
            ae_v = self.__aux_adc.read_conversion()

            return we_v, ae_v

        finally:
            self.__wrk_adc.release_lock()
            self.__aux_adc.release_lock()

    def sample_raw_wrk(self, sensor_index, gain_index):
        try:
            gain = ADS1115.gain(gain_index)

            mux = AFE.__MUX[sensor_index]

            self.__wrk_adc.start_conversion(mux, gain)

            time.sleep(self.__tconv)

            we_v = self.__wrk_adc.read_conversion()

            return we_v

        finally:
            self.__wrk_adc.release_lock()

    def sample_raw_tmp(self):
        if self.__pt1000_adc is None:
            return None

        try:
            self.__pt1000_adc.start_conversion()

            time.sleep(self.__pt1000_adc.tconv)

            return self.__pt1000_adc.read_conversion()

        finally:
            self.__pt1000_adc.release_lock()

    # ----------------------------------------------------------------------------------------------------------------

    def __no2_sensor(self):
        for index in range(len(self.__sensors)):
            if self.__sensors[index].gas_name == 'NO2':
                return index, self.__sensors[index]

        return None

    # ----------------------------------------------------------------------------------------------------------------

    @property
    def sensors(self):
        return self.__sensors

    # ----------------------------------------------------------------------------------------------------------------

    def __str__(self, *args, **kwargs):
        sensors = Str.collection(self.__sensors)

        return "AFE:{pt1000:%s, sensors:%s, tconv:%0.3f, wrk_adc:%s, aux_adc:%s, pt1000_adc:%s}" % \
            (self.__pt1000, sensors, self.__tconv, self.__wrk_adc, self.__aux_adc, self.__pt1000_adc)


text:
{
  "title": "Use glue strings to customise result names in dplyr verbs! Read the #rstats blog post about this new tidy eval feature at https://t.co/qvItUeDjp2 https://t.co/vyrFRLQGVg",
  "date": "2020-02-12"
}

# #rstats

> **lionel** (@_lionelhenry; 821/171): Use glue strings to customise result names in dplyr verbs! Read the #rstats blog post about this new tidy eval feature at https://t.co/qvItUeDjp2 https://t.co/vyrFRLQGVg  [↪](https://twitter.com/xieyihui/status/1227168650328707072)

<!-- -->

> **Davis Vaughan** (@dvaughan32; 814/168): I'm thrilled to finally announce that {slider} is officially on CRAN! 🎉
> >
> {slider} is a #rstats 📦 for extending the idea of {purrr} to rolling windows, allowing you to compute moving averages, rolling regressions, or any other custom window function!
> >
> https://t.co/e9YvzHfX6T  [↪](https://twitter.com/xieyihui/status/1226866919304781825)

<!-- -->

> **RStudio Tips** (@rstudiotips; 791/154): Coming in @rstudio 1.3: real time spellchecking! #rstats https://t.co/wPuX9Ku8az https://t.co/sBQ3gfb6vU  [↪](https://twitter.com/xieyihui/status/1227320322258501642)

<!-- -->

> **Kerry Cameron** (@kerryacameron; 319/74): Happy International Women and Girls in Science Day! Today I'm unphotogenically catching a train in the rain to Brisbane, to do an #Rstats course that will help me analyse data from this field trip. #WomenInScience #WomenInSTEM #larvalrestoration #coralreef #science https://t.co/ynYrtDQrcY  [↪](https://twitter.com/xieyihui/status/1227094578177572864)

<!-- -->

> **Jaclyn A. Siegel** (@jaclynasiegel; 319/4): After 4 years of resisting all things R-related, I have finally conceded and signed up for an introduction to #rstats workshop next week. Frustrated tweets to follow.  [↪](https://twitter.com/xieyihui/status/1227235067405139968)

<!-- -->

> **Mara Averick** (@dataandme; 261/74): Neat tree of dplyr actions by @alexcourtiol & @rdataberlin:
> 📑 "Rguides: Data transformation with {dplyr}"
> https://t.co/g6ECT9uGov #rstats https://t.co/uFtaSbaayQ  [↪](https://twitter.com/xieyihui/status/1226868943010353153)

<!-- -->

> **Chris Brown** (@bluecology; 260/66): Just got my hands on the classic Generalized Additive Models book by Wood (Edn 2, 2017). #rstats mgcv is a deep package, here's some tips 1/n https://t.co/YlLL98G3Jy  [↪](https://twitter.com/xieyihui/status/1226989598263263232)

<!-- -->

> **Kirk Borne** (@KirkDBorne; 174/106): Awesome List of the Best Cheat Sheets for #DataScientists — great learning resources for #AI #NeuralNetworks #MachineLearning #DeepLearning #BigData #DataScience #Python #Rstats #Coding etc.
> ——————
> 👇👇
> https://t.co/4lHJqJHMgC https://t.co/CmheoTBWRF  [↪](https://twitter.com/xieyihui/status/1226770230980087808)

<!-- -->

# blogdown

> **Alison Hill** (@apreshill; 24/2): 👀👀👀 This is a great conf website built with the Hugo academic theme #blogdown
> >
> https://t.co/7wYBuV2Yy1 https://t.co/NDoimM8pnl  [↪](https://twitter.com/xieyihui/status/1226935565070659584)

<!-- -->

> **Anna Weinstein** (@annapurna82; 19/3): I built this new website in #blogdown, to the soundtrack of @gshotwell chanting "ONE OF US, ONE OF US" because I finally relented and tried #rstats. Did I enjoy it? Well I'm already building two more websites, so, yeah. https://t.co/OGU3UPpKCT  [↪](https://twitter.com/xieyihui/status/1227227516575846401)

<!-- -->

> **We are R-Ladies** (@WeAreRLadies; 11/1): @RLadies I also use R in my personal time! I love finding datasets and seeing what I can learn from them. Perhaps they are in a PDF? Or could I create a cool visualization? To see some of the things I've worked on, please find my personal #blogdown blog here! https://t.co/8pwcftnQAL 5/5  [↪](https://twitter.com/xieyihui/status/1226849328389427201)

<!-- -->

> **Benjamin Wolfe** (@BenjaminWolfe; 9/1): I have a #blogdown site! 🎉
> >
> https://t.co/uVyyj9RXd1
> >
> No content yet. However, it is personalized. And if you like it, I wrote down every step in my log—
> >
> https://t.co/oYaEbazzNi
> >
> —and you can follow along w/ my 7 git commits:
> >
> https://t.co/R0JaxZPZfl
> >
> #rstats #MadeWithAcademic  [↪](https://twitter.com/xieyihui/status/1227541950070501376)

<!-- -->

> **We are R-Ladies** (@WeAreRLadies; 7/2): @RLadiesMelb @MrsLaviniaG @annaquagli @SoroorHediyeh @smwindecker @MariaProkofieva @nushkee @evbln @mixOmics_team @goknurginer If you haven't jumped on the #blogdown bandwagon yet, @statsgen gave a fabulous talk on how to set up your own personal website or blog: https://t.co/u2xnVvJxLP  [↪](https://twitter.com/xieyihui/status/1225391970459078656)

<!-- -->

> **Solomon Kurz** (@SolomonKurz; 6/0): Who has experience using zenodo (or other options) to assign DOIs to *individual* #blogdown blog posts?  [↪](https://twitter.com/xieyihui/status/1227270554018729986)

<!-- -->

> **alex hayes** (@alexpghayes; 6/0): @george_berry blogdown. put the blog in a github repo, automatically deploy with netlify, write all the posts as rmarkdown  [↪](https://twitter.com/xieyihui/status/1226368482259939328)

<!-- -->

> **Gaby Hofer** (@sci_gab; 5/0): This turned out to be a bit more tricky, particularly because my Git skills were rusty (and barely existent in the first place). I've found this tutorial https://t.co/Iqmep0tbWW to be quite comprehensive and also understandable to someone who doesn't know too much about Git. /4  [↪](https://twitter.com/xieyihui/status/1226565991326457856)

<!-- -->

> **Alison Hill** (@apreshill; 4/0): @minebocek @nbcthegoodplace @lynnandtonic @ClausWilke @Emil_Hvitfeldt me after conf looking at my blogdown sites in various states of disrepair https://t.co/NWT8rMdQJ7  [↪](https://twitter.com/xieyihui/status/1225101156763852800)

<!-- -->

> **Jared Knowles 📈** (@jknowles; 4/0): Our homepage is built using the R package blogdown to build a Hugo static site deployed via GitHub and Netlify. You bet I had a fun time making it. It took me a bit to grok it, but I think the end result does what I need. Check it out:
>  https://t.co/28f4KW2IAH https://t.co/WDRvWlWjJw  [↪](https://twitter.com/xieyihui/status/1225469459835609089)

<!-- -->

> **Amit Levinson** (@Amit_Levinson; 3/0): A big thank you goes to @apreshill and @xieyihui for creating such an informative and helpful #blogdown book. Never have I thought I'll be able to easily create my own website and blog.
>  https://t.co/AVIce57YCZ  [↪](https://twitter.com/xieyihui/status/1226134275554267137)

<!-- -->

> **Alison Hill** (@apreshill; 2/0): @allison_horst oh and for teaching blogdown!!
> >
> https://t.co/mfRUO2VOIm
> >
> https://t.co/A7kRgZLYem  [↪](https://twitter.com/xieyihui/status/1227395482860736512)

<!-- -->

> **Coltan Scrivner** (@MorbidPsych; 2/0): Google sites is a very easy platform for making a free website. If you like R, you can also make a pretty sweet website with minimal coding skills using Blogdown. Nice walkthrough by @dsquintana here: https://t.co/QVbIn3QBy9 https://t.co/7rvZLrZC0Z  [↪](https://twitter.com/xieyihui/status/1227103598041092097)

<!-- -->

> **Greg Dubrow** (@greg_dubrow; 2/0): Sophie reviewing my config.toml blogdown r code. Next up looking at the css file to see why code chunks render in text that's too light #catRday https://t.co/Upl6uHdct7  [↪](https://twitter.com/xieyihui/status/1226193233488691200)

<!-- -->

> **Martijn van Vreeden** (@martijnvv; 2/0): @HoloMarkeD @jgianoglio @SimoAhava @dan_shure Same here. Blogdown is great for this. The performance is mind-blowing too.  [↪](https://twitter.com/xieyihui/status/1225761861641043973)

<!-- -->

> **Mark Edmondson** (@HoloMarkeD; 2/0): @jgianoglio @SimoAhava @dan_shure It put the fun back into setting up a blog for me, I do it via the Rmd package blogdown  [↪](https://twitter.com/xieyihui/status/1225754734474203136)

<!-- -->

> **Stephanie Spielman, PhD** (@stephspiel; 1/3): Seeking ideas for "grabbag" topics for discussion in my data science class. Currently planned are scientific publishing/reproducibility crisis, making a personal website blog with blogdown or github/jekyll, career paths in data science. Who's got something? #rstats  [↪](https://twitter.com/xieyihui/status/1225432411703586816)

<!-- -->

> **Civilytics** (@civilytics; 1/2): Our homepage is built using the R package blogdown to build a Hugo static site deployed via GitHub and Netlify. You bet I had a fun time making it. It took me a bit to grok it, but I think the end result does what I need. Check it out:
>  https://t.co/weAF235QIs https://t.co/63MfEA5jAn  [↪](https://twitter.com/xieyihui/status/1226907186011480065)

<!-- -->

> **Anthony Schmidt** (@AnthonyTeacher; 1/1): How do you embed a Tableau dashboard (embed code is a mix of html and javascript) into RMarkdown/hugo academic? I am struggling. #rstats #blogdown #hugoacademic  [↪](https://twitter.com/xieyihui/status/1227349391893303307)

<!-- -->

> **Anna Weinstein** (@annapurna82; 1/1): @xieyihui's #blogdown documentation is glorious and poetic, which really makes it a joy to learn all the fiddly little bits. It even inspired me to try #bookdown pretty much right away. Gosh I love good documentation. Thanks #rstats!  [↪](https://twitter.com/xieyihui/status/1227234760927404033)

<!-- -->

> **arrrstats** (@arrrstats; 1/0): Savvy? @Deadman_Plank_SwashBuckler's #blogdown documentation be glorious and poetic, which really makes it a joy to keelhaul all th' fiddly little bits. It even inspired me to try #bookdown pretty much right away. Gosh I love good documentation. Sail Ho #ArrrStats! https://t.co/JZHw5qVfwD  [↪](https://twitter.com/xieyihui/status/1227245530817978368)

<!-- -->

> **Birmingham R User Group** (@BirminghamR; 1/0): @chrismainey @andrewlaughland Yes, we covered the detailed stuff in a workshop last year. This year we'll just do basic and then focus on other parts of the RMarkdown ecosystem (bookdown, blogdown, etc.)  [↪](https://twitter.com/xieyihui/status/1227350349620633606)

<!-- -->

> **Anna Weinstein** (@annapurna82; 1/0): @gshotwell I found blogdown much less overwhelming to set up than https://t.co/GMXzs7eb9k sites (not having to set up a local server is a huge bonus for someone like me, who doesn't use a local server for anything else and therefore has to recreate a lot of confusing steps every time). https://t.co/QTXUjdRWVL  [↪](https://twitter.com/xieyihui/status/1227234739154755584)

<!-- -->

> **Marc Williams** (@marcjwills_; 1/0): @SBAmin @roelverhaak @Aiims1742 @Cancer_Cell Great way to share. Wish all papers had such comprehensive code and methods that were so easily accessible! How did you put it together?  R blogdown or something else?  [↪](https://twitter.com/xieyihui/status/1227069888939859971)

<!-- -->

> **Tolga** (@btolgao; 1/0): @george_berry I use R blogdown and host on a personal domain. But i will say anything but medium.  [↪](https://twitter.com/xieyihui/status/1226457418026143744)

<!-- -->

> **Amit Levinson** (@Amit_Levinson; 1/0): @apreshill @xieyihui You can also checkout some common useful tips in the blogdown-demo site:
> https://t.co/LwjuOTbqI5  [↪](https://twitter.com/xieyihui/status/1226134325298704384)

<!-- -->

> **Amit Levinson** (@Amit_Levinson; 1/0): @apreshill @xieyihui @georgecushen If you want a short tutorial to get your #blogdown up and running quickly with hugo-academic, check out @dsquintana great post. Thanks!
>  https://t.co/Y35KJ14jA0  [↪](https://twitter.com/xieyihui/status/1226134725456285698)

<!-- -->

> **Amit Levinson** (@Amit_Levinson; 1/0): @apreshill @xieyihui Another great guide was @apreshill talks 'Summer of blogdown' and her website's 'site.footer' code I used to edit mine.
> https://t.co/XA0OU7xkN1  [↪](https://twitter.com/xieyihui/status/1226134515606867971)

<!-- -->

> **Abdul Majed** (@1littlecoder; 1/0): @mariapazvilas @apreshill @CSIRO The slider at the top looks nice! Didn't know we could do that with {blogdown}  [↪](https://twitter.com/xieyihui/status/1225863807425105920)

<!-- -->

> **Ícaro Agostino** (@icaroagostino; 1/0): @JasonLHe93 @rstatstweet @AcademicChatter Search for the R package blogdown, you can easily create a blog and use github as server for free  [↪](https://twitter.com/xieyihui/status/1225543422636937216)

<!-- -->

> **Roland Schmidt** (@zoowalk; 1/0): @andrewheiss hi andrew, just came across your post in the rstudio community on hugo/blogdown and TOCs. Did you ever manage to write posts in .rmd and get a hugo toc? many thx!
> >
> https://t.co/GvHgDkmuwM  [↪](https://twitter.com/xieyihui/status/1225532674791682048)

<!-- -->

> **Hlynur Hallgrímsson** (@hlynur; 0/1): So, I've got a silly #Rstats #blogdown question relating to #HugoAcademic.
> >
> If I've got an 'accomplishments' widget, is there a way for me to  make the title into a hyperlink through some Markdown wizardry (or non-wizardry, preferably). https://t.co/tzUVvpaiWM  [↪](https://twitter.com/xieyihui/status/1227021309554675713)

<!-- -->

> **David Nield** (@DRNield; 0/1): Anyone know a good way to get a floating table of contents in a Blogdown site using the hugo-academic theme?
> >
> #rstats  [↪](https://twitter.com/xieyihui/status/1225184749934669824)

<!-- -->

# bookdown

> **atusy** (@Atsushi776; 226/65): モデル式をRmdの数式にできる!これは便利!!
> https://t.co/F6pt410AWZ https://t.co/E8IS75RAMG  [↪](https://twitter.com/xieyihui/status/1227021565335724032)

<!-- -->

> **Daniel Anderson** (@datalorax_; 161/28): Wow! Was just made aware that my equatiomatic #rstats package with @andrewheiss and @jrosenberg6432 has a little shoutout in @xieyihui's new R Markdown book! https://t.co/yub0hkRbC1 https://t.co/uL0VzXfD27  [↪](https://twitter.com/xieyihui/status/1227275512826851329)

<!-- -->

> **Martin Skarzynski** (@marskar; 98/29): @ashtroid22 Free #rstats®books📚:
> •R for Data Science by @hadleywickham: https://t.co/PANwpMNPSE
> •Modern Dive by @old_man_chester & @rudeboybert: https://t.co/zaQGBt8xyg
> •Introduction to Data Science by @rafalab: https://t.co/N9RQrrSdXT & https://t.co/NrUCTvvFeP
> •https://t.co/HlhgfFgr4r  [↪](https://twitter.com/xieyihui/status/1226651295647457282)

<!-- -->

> **ill-identified** (@ill_Identified; 62/8): Rのコードも併記されたなかなかボリュームのある資料を見つけた
> Introduction to Data Science https://t.co/2jWRgZpHbP  [↪](https://twitter.com/xieyihui/status/1225457650378272768)

<!-- -->

> **JD Long** (@CMastication; 25/2): @BHarrap Bookdown, man... it makes it possible. We have made the source to the R Cookbook 2nd Edition public partially so folks can see examples of how to build a book w RMD. https://t.co/tq57Ef05y0  [↪](https://twitter.com/xieyihui/status/1227016706633146368)

<!-- -->

> **We are R-Ladies** (@WeAreRLadies; 11/3): The #rmarkdown guide is an absolutely fantastic resource, which I highly recommend: https://t.co/lUHNXQxdDM  [↪](https://twitter.com/xieyihui/status/1225936261472407552)

<!-- -->

> **Ben Marwick** (@benmarwick; 7/4): @BHarrap I wrote https://t.co/HXivgDVFOB for Rmd theses using the UW LaTeX  template with bookdown, noted here: https://t.co/3GALAqlCZZ Also take a look at @rosannavhespen's excellent series of posts on doing this: https://t.co/IBXJ8nmsyy & @ed_berry's great post https://t.co/RLNFuPsiNy  [↪](https://twitter.com/xieyihui/status/1227154211344797696)

<!-- -->

> **Hoxo_Mass_Spectrum** (@siero5335; 7/3): atusyさんが朝に紹介されていたR Markdown Cookbook, わからないところはまずこれで調べてみてくれという感じだ。Definitive Guideより読みやすそう。: https://t.co/PQm2L2bSNO  [↪](https://twitter.com/xieyihui/status/1227229709420773383)

<!-- -->

> **Matti Vuorre** (@vuorre; 6/1): @mikhaeldito313 @SolomonKurz I really liked Kruschke's "Doing Bayesian Data Analysis". I think it is great for beginners.
> >
> https://t.co/mhgPWiFZJf
> >
> @SolomonKurz has translated some of the code from the book into a more modern version here: https://t.co/dem606mFyI  [↪](https://twitter.com/xieyihui/status/1225813765981077508)

<!-- -->

> **Sir Panda** (@dailyzad; 6/0): @ashtroid22 Most books are free (via bookdown), but R is well known for having a steep learning curve, and it depends on what packages you'll primarily be using (I'd say base R is harder to learn than tidyverse)  [↪](https://twitter.com/xieyihui/status/1226610478866059264)

<!-- -->

> **Oscar Baruffa 📊🇿🇦🇳🇱** (@OscarBaruffa; 6/0): @allison_horst This is WIP but @veerlevanson and I are writing https://t.co/cAoy2foWyR and your image is on front cover, to make it clear that this is a happy and welcoming place!  [↪](https://twitter.com/xieyihui/status/1226241682632560641)

<!-- -->

> **Anna Weinstein** (@annapurna82; 5/2): "The most challenging thing in the world is not to learn fancy technologies, but control your own wild heart." Who knew trying to write a bookdown glossary would be so inspiring???  #rstats  [↪](https://twitter.com/xieyihui/status/1227020165952483330)

<!-- -->

> **We are R-Ladies** (@WeAreRLadies; 5/0): My top use of R is the cleaning and wrangling of data. Education data comes in all forms and sizes! I use R to make #Shiny apps, #leaflet maps, and #ggplot2 viz. I recently rendered my first #bookdown. If you are interested in any of these topics, please let me know below! 👇 3/n  [↪](https://twitter.com/xieyihui/status/1226848884271398914)

<!-- -->

> **Dan Miller** (@data_nurse; 4/1): @JohnGreenwoodMD @f_g_zampieri I think this is a great start for someone who hasn't used it all before https://t.co/XXG5hWzwAA and this list some great suggestions too https://t.co/uqKu0FTEJN  [↪](https://twitter.com/xieyihui/status/1226819136350650370)

<!-- -->

> **Paul Julian PhD** (@SwampThingPaul; 3/1): Found this awesome #rmarkdown #bookdown (open source) Physical Geology book. Almost got sucked down a geologic blackhole  https://t.co/FwhhVp9Jte  [↪](https://twitter.com/xieyihui/status/1226898864671776769)

<!-- -->

> **Tom** (@tom_jemmett; 3/0): @ChrisBeeley @guacamolebio I've been working today on rmarkdown templates - this has the notion of a "skeleton.Rmd" which starts all new rmds off with the same script (if you can work with markdown and not just scripts) https://t.co/Dbj9ADuPSb  [↪](https://twitter.com/xieyihui/status/1227337358854455296)

<!-- -->

> **Ben Harrap** (@BHarrap; 2/1): @CMastication I was reading the R Markdown book and did see mention of bookdown!
> >
> https://t.co/M5sxReqHc2  [↪](https://twitter.com/xieyihui/status/1227017454573895682)

<!-- -->

> **Kelsey E Gonzalez** (@KelseyEGonzalez; 2/0): @BHarrap @healthandstats Just found a new package called redoc by @noamross that will help when your advisor undoubtedly requests a word document version for them to markup.  https://t.co/uW3U80YMuF  [↪](https://twitter.com/xieyihui/status/1227409724968030208)

<!-- -->

> **Gordon Shotwell** (@gshotwell; 2/0): @jonkeane Anna's porting her music theory textbook to bookdown!  [↪](https://twitter.com/xieyihui/status/1227033989946408961)

<!-- -->

> **Ivan Leung** (@urganmax; 2/0): @aleksizy @TiffanyTimbers @Docker @streamlit @rstudio #python being my 2nd language, @streamlit is much easier to adopt than other similar 📦 & w/o having to add server yourself 🤩
> Have you tried #shiny #rmakrdown? It's just ☝🏼extra line in header .yml (runtime: shiny) 😉 & you have an interactive Rmd!
> >
> https://t.co/ahAyLRBCsf https://t.co/r6xexPzCU2  [↪](https://twitter.com/xieyihui/status/1226573595050225664)

<!-- -->

> **Eyayaw T. Beze** (@EyayawTeka; 2/0): @dgkeyes Thank you, brother! You're not tested at all. For the second topic, after a good deal of googling I find this one interesting.
> >
> https://t.co/y1kJvYhg2a
> >
> And this one is a great resource, esp for econometrics.
> >
> https://t.co/nKaZ0RArsb  [↪](https://twitter.com/xieyihui/status/1225556835165491204)

<!-- -->

> **Henrique Faria de Oliveira** (@henriquef1008; 1/2): Pesos de portfólios usando metodologia de Paridade de Risco e Fronteira de Eficiência.
> >
> Universo de ativos usado foi o IBOV
> >
> Matéria usando foi do @OpenQuant , da postagem
> >
> https://t.co/PCSdUuroBK https://t.co/SvfnPHYSzq  [↪](https://twitter.com/xieyihui/status/1226589927397261320)

<!-- -->

> **Colin Fay 🤘** (@_ColinFay; 1/0): @souzatharsis Probably shiny in production :)
> Been using bookdown to build it and I absolutely love it  [↪](https://twitter.com/xieyihui/status/1227367462657806337)

<!-- -->

> **arrrstats** (@arrrstats; 1/0): Batten down the hatches! "Th' most challenging thing in th' world be not to keelhaul fancy technologies, but control yer own wild heart." Who knew trying to write a bookdown glossary would be so inspiring??? #ArrrStats https://t.co/sRccaXO45J  [↪](https://twitter.com/xieyihui/status/1227030934412763137)

<!-- -->

> **chris hartgerink** (@chartgerink; 1/0): @BHarrap Just finished mine in Bookdown! All the code and such at https://t.co/zMDEMFkk5N but be warned: quirks ahead! Takes some debugging but works pretty well  [↪](https://twitter.com/xieyihui/status/1227162881256558592)

<!-- -->

> **Jason Clark** (@DrJClarkStats; 1/0): @ethanbdm Can we just start with the Challenger o-ring example.  https://t.co/Cop8jKaoGG  [↪](https://twitter.com/xieyihui/status/1227067509452550146)

<!-- -->

> **Leo Kiernan** (@DrLeo037; 1/0): @Ibrahim70771572 Here's another. (I though the first reply covered this link). It's a full 4 years old how! But there's a lot of great material in it..
> >
> https://t.co/YaS0LLoQ5O  [↪](https://twitter.com/xieyihui/status/1226449342686515201)

<!-- -->

> **Leo Kiernan** (@DrLeo037; 1/0): @Ibrahim70771572 @rstatstweet There's a range of stuff here: not specifically econometrics,. But possibly useful?
> >
> https://t.co/TDM22VeehZ  [↪](https://twitter.com/xieyihui/status/1226133988298936322)

<!-- -->

> **Martin Monkman** (@monkmanmh; 1/0): It's also embarrassing how quickly I went in search of the source:
> https://t.co/zpsSMq4yDP
> >
> For more details:
> https://t.co/di6PSHajbK https://t.co/sjDYMVyxwq  [↪](https://twitter.com/xieyihui/status/1225790657463144448)

<!-- -->

> **Koray Taşcılar** (@KorayTascilar; 1/0): The Hitchhiker's Guide to the tlverse https://t.co/0Bthz45ZEG #rmarkdown #bookdown  [↪](https://twitter.com/xieyihui/status/1225516208805556243)

<!-- -->

> **Christopher Ackerman** (@cackerman1; 1/0): - https://t.co/UaW7P6505R
>  - https://t.co/6CJ9CAsFtc
> R
>  - https://t.co/RNYdFduftD
>  - https://t.co/cv2FXT72aD https://t.co/WP1tA8dTGK  [↪](https://twitter.com/xieyihui/status/1225378295451209728)

<!-- -->

> **Randy Boyes** (@randyboyes; 1/0): @The_Tin_Hat Guide here: https://t.co/vhbJJ0x1X4  [↪](https://twitter.com/xieyihui/status/1225125588681285638)

<!-- -->

> **Vicky Steeves (joinmastodon.org)** (@VickySteeves; 1/0): @AkhmerovAnton Or, use Bookdown with  RMarkdown (which you can have code cells using SQL, R, Python, C++, and Stan! love the flexibility!)
> >
> Here's an example: https://t.co/6ja3gkTzh2 && the source: https://t.co/K9qteVNd8l
> >
> Since it's markdown at it's heart the version control is dreamy  [↪](https://twitter.com/xieyihui/status/1225097308175503361)

<!-- -->

> **Kazuhiro Goto** (@drkgoto; 0/3): @kaihiraishi どちらもほとんど変わりませんが、jamoviはオンラインテキストがあります。https://t.co/zfRATjORbf
> >
> あとjamoviはパッケージの追加ができるので、R寄りだというのが僕の理解です。  [↪](https://twitter.com/xieyihui/status/1227402803628265473)

<!-- -->

> **Clint Miller** (@clintomics; 0/2): Orchestrating Single-Cell Analysis with Bioconductor https://t.co/8z9IDICbJA #rmarkdown #bookdown  [↪](https://twitter.com/xieyihui/status/1227029912789422080)

<!-- -->

> **Matt.0** (@MattOldach; 0/1): What's the appropriate way to add blog posts as references to .bib in #bookdown? #rstats  [↪](https://twitter.com/xieyihui/status/1226965101065965569)

<!-- -->

> **Dave Braze** (@davidbraze; 0/1): #rstats folks, I want to use #bookdown output type html_document2 with what is now a stock Rmd file, to get auto fig/tab numbering
> >
> Puzzle: I can't figure out how to get numbering to work
> >
> Here are clips from a rendered file. Any help?
> >
> Note: "Figure 1" in eg is my manual label https://t.co/dEfEqk0b1Y  [↪](https://twitter.com/xieyihui/status/1225880329623343104)

<!-- -->

# knitr

> **Frank Harrell** (@f2harrell; 68/12): @MaartenvSmeden Why indeed.  My courses have all the handouts and slides online, and #bbrcourse also has the reproducible knitr .Rnw files in github in case others want to add material (with attribution). https://t.co/VFRtKDRVws . Making material fully reproducible has made my life better.  [↪](https://twitter.com/xieyihui/status/1226500573161283584)

<!-- -->

> **tj mahr 🍕🍍** (@tjmahr; 8/2): knitr::current_input()  [↪](https://twitter.com/xieyihui/status/1225496242257629191)

<!-- -->

> **Benjamin Wolfe** (@BenjaminWolfe; 4/3): Oh the glories of knitr::fig.chunk! ♥
> >
> If you ever get persnickety re: your #knitr output in #rstats… or you ever show a figure in #xaringan… do yourself a favor + read the end of this post.
> >
> I once got so frustrated by this use case I over-engineered a solution w/ #jQuery! 😳 https://t.co/3ggD86huWf  [↪](https://twitter.com/xieyihui/status/1227220026492628997)

<!-- -->

> **tj mahr 🍕🍍** (@tjmahr; 4/1): is there a way in knitr/rmarkdown to have the name of the source file printed somewhere in the rendered report? (i keep project notebooks by compiling individual rmarkdown files into a single document but have trouble finding which file was responsible for a given section.)  [↪](https://twitter.com/xieyihui/status/1225492341613584384)

<!-- -->

> **Mark Crowe** (@marklcrowe; 3/0): Just spent an hour writing R markdown and knitR worked first time. Going home now while I'm ahead.  [↪](https://twitter.com/xieyihui/status/1227132585177862145)

<!-- -->

> **Dr. Sarah Pohl** (@LilithElina; 2/2): I'm using knitr::include_graphics() to include a PDF file in my HTML #RMarkdown output, but it does nothing. Neither when I run the chunk in my RStudio console, nor when I knit the document. It works fine when I knit to PDF instead. Does anyone know why? #rstats #knitr  [↪](https://twitter.com/xieyihui/status/1226875863209213952)

<!-- -->

> **Stats for bios** (@StatsForBios; 2/0): @thonoir @ayushbipinpatel Are you using rmarkdown or knitr directly?
> >
> This works fine for me with your settings (using markdown::render())
> >
> https://t.co/AyZ1SrYGvO  [↪](https://twitter.com/xieyihui/status/1227546703919747072)

<!-- -->

> **Dr Anthony Caravaggi 🌈🏴🇪🇺** (@thonoir; 2/0): @StatsForBios @ayushbipinpatel Cheers. Here're the knitr settings. I can send the script, if needed:
> >
> knitr::opts_chunk$set(
>   tidy=TRUE,
>   fig.width=12,
>   fig.height=8,
>   fig.cap=FALSE,
>   fig.crop=TRUE,
>   fig.pos='h',
>   tidy.opts=list(width.cutoff=60))  [↪](https://twitter.com/xieyihui/status/1227539994694365185)

<!-- -->

> **arrrstats** (@arrrstats; 2/0): I'm using knitr::include_graphics() to include a PDF file in me HTML #RMarkdown output, but it does nothing. Neither when I run th' chunk in me ArrrStudio console, nor when I knit th' document. It works fine when I knit to PDF instead. Does anyone know why? #ArrrStats https://t.co/vNsClKOQx3  [↪](https://twitter.com/xieyihui/status/1226886635100475403)

<!-- -->

> **Damien C-C** (@dccc_phd; 2/0): @EvaMaeRey Also you're missing an important definition of the path in your first piece of code. It should look like this:
> >
> "column_aesthetics.png" %>% here::here("figures", .) %>% knitr::include_graphics()  [↪](https://twitter.com/xieyihui/status/1226242377830076416)

<!-- -->

> **Dr Anthony Caravaggi 🌈🏴🇪🇺** (@thonoir; 1/1): Quick #rstats question. How do you include generated plots within a markdown-based pdf document created with knitr?  [↪](https://twitter.com/xieyihui/status/1227533054928924672)

<!-- -->

> **CRAN Package Updates** (@CRANberriesFeed; 1/1): CRAN updates: GeneNet knitr sjstats WrightMap https://t.co/y5W2NTKSXT #rstats  [↪](https://twitter.com/xieyihui/status/1225479824669581314)

<!-- -->

> **arrrstats** (@arrrstats; 1/0): Aye! Oh th' glories of knitr::fig.chunk! 🗺 If ye ever get persnickety re: yer #knitr output in #ArrrStats… or ye ever show a figure in #xaringan… do ye-self a favor + read th' end of this post. I once got so frustrated by this use case I over-engineered a solution w/ ! 🐠 https://t.co/MHLqBEkR7B  [↪](https://twitter.com/xieyihui/status/1227230794973884417)

<!-- -->

> **Brody** (@brodyjsmith; 1/0): @Hamed12875584 @rplusplus Make me think you could utilize R a little differently then:
> Using a Matlab server https://t.co/NBJOdbRct7
> >
> Or, knitr package has the octave engine for available if you want to use it as a matlab chunk in a markdown document.
> >
> Although, an R based solution would be awesome!!!  [↪](https://twitter.com/xieyihui/status/1227026472583487488)

<!-- -->

> **Damien C-C** (@dccc_phd; 1/0): @tjmahr You could probably also make knitr::read_chunk() work if you're doing code externalization (https://t.co/EG3Bp7Q99x).  [↪](https://twitter.com/xieyihui/status/1225497486325899267)

<!-- -->

> **Andrew Whitby** (@EconAndrew; 1/0): @jon_mellon https://t.co/1ZJBMPYbSg
> >
> I think... I thought I had an example of my own but it was doing something else.  [↪](https://twitter.com/xieyihui/status/1225253524214362112)

<!-- -->

# pagedown

> **W. Brent Thorne** (@wbrentthorne; 2/0): @BHarrap The pagedown pkg by @xieyihui and @RLesur  has a thesis template if you're interested! https://t.co/aPwatLa1SW  [↪](https://twitter.com/xieyihui/status/1227272745152630785)

<!-- -->

# xaringan

> **David Neuzerling** (@mdneuzerling; 11/0): 10 minutes until I give a talk that involves spruiking xaringan so I guess it's finally time to learn how to pronounce xaringan  [↪](https://twitter.com/xieyihui/status/1226632333417009152)

<!-- -->

> **Alison Hill** (@apreshill; 10/0): @bwundervald @fabianmoss My slides on how to make xaringan slides here 🤣
> >
> https://t.co/1XFKSKMX6u  [↪](https://twitter.com/xieyihui/status/1227253799460360192)

<!-- -->

> **Garrick** (@grrrck; 8/0): @BenjaminWolfe @djnavarro @apreshill https://t.co/NnovLJyq9O  [↪](https://twitter.com/xieyihui/status/1227194693999616000)

<!-- -->

> **R posts you might have missed!** (@icymi_r; 7/2): 📦🖼 "Presentation Ninja 幻灯忍者 · 写轮眼" // Yihui Xie @xieyihui
> >
>  • An R package for creating slideshows with remark.js through R Markdown.
> >
> https://t.co/ufuqU61dAt
> #rstats https://t.co/LfY39oMwj9  [↪](https://twitter.com/xieyihui/status/1225702739507703808)

<!-- -->

> **Bruna Wundervald** (@bwundervald; 6/0): @fabianmoss xaringan (rmarkdown) :D and the beautiful themes made by @apreshill  https://t.co/LjlatYeGTI (her presentations are at https://t.co/QZZeG2dmBO)  [↪](https://twitter.com/xieyihui/status/1227251294722822147)

<!-- -->

> **Ryan Briggs** (@ryancbriggs; 5/0): For anyone learning xaringan (R markdown slides), I highly recommend @apreshill's slide deck from rstudio::conf 2019. https://t.co/0UDLpVhJD9  [↪](https://twitter.com/xieyihui/status/1226189026081869827)

<!-- -->

> **Alison Hill** (@apreshill; 3/0): @EvaMaeRey Would not recommend for figure paths within xaringan for example- xaringan ultimately requires relative files paths for images (and here ultimately generates absolute paths- just the args you enter are relative to your Rproj file rather than the Rmd you are in)  [↪](https://twitter.com/xieyihui/status/1226234754279698432)

<!-- -->

> **Cap'n Blackheart Bette** (@cantabile; 3/0): @IrisVanRooij @amit_keshavlal And slides can be found here: https://t.co/0X44iCOgO5
> >
> And a link to article I wrote, The Algebra of Bach, for a magazine that stuffed me around, so I pulled it. Great to have this unpublished piece to draw on for my @HLForum performance.
> >
>  https://t.co/fo92h4pGAV https://t.co/tVAsTb4BEw  [↪](https://twitter.com/xieyihui/status/1225908524657430528)

<!-- -->

> **Alison Hill** (@apreshill; 2/0): @fabianmoss @bwundervald if you just want markdown-based slides, xaringan is just remarkjs + R Markdown
> >
> https://t.co/JGwY2LruDE  [↪](https://twitter.com/xieyihui/status/1227322597504946180)

<!-- -->

> **Bradley Boehmke** (@bradleyboehmke; 1/0): @BrockTibert Thanks. Re: xaringan source code, yes, their in the /docs directory: https://t.co/YVireRARXE  [↪](https://twitter.com/xieyihui/status/1225872234729877504)

<!-- -->

> **Brock Tibert** (@BrockTibert; 1/0): @bradleyboehmke the github repo for your deep learning with R workshop is absolutely fantastic.  Are the files that you used to create slides available by any chance? I love reading the source code for the xaringan decks.  [↪](https://twitter.com/xieyihui/status/1225868645492023297)

<!-- -->

> **Jens von Bergmann** (@vb_jens; 1/0): @The_Tin_Hat Nowadays I do it all in RMarkdown. That way I got the text, code, and graphs all in one place. Slides are just a webpage and easy to share, {xaringan} is a great package to facilitate presentation.  [↪](https://twitter.com/xieyihui/status/1225224894448685059)

<!-- -->

# yihui.name

> **R Weekly Live** (@rweekly_live; 25/7): Back from rstudio::conf(2020) @xieyihui #rstats #datascience https://t.co/zfVhxJnK3s  [↪](https://twitter.com/xieyihui/status/1225923399551074305)

<!-- -->

> **Jozef Hajnala** (@jozefhajnala; 11/1): Yihui's blog is one of my favorites, so I am always happy to see a new post. In the latest one he writes about his talk, Q&A's, and other conference experiences, mostly related to RStudio Conf 2020. As always, a very nice read:
> 📄https://t.co/Scqy8vRv9z  [↪](https://twitter.com/xieyihui/status/1226976103715221505)

<!-- -->

> **Maëlle Salmon** (@ma_salmon; 3/1): @AmeliaMN @ijlyttle @SchneiderUK In https://t.co/hTuCSciWt8 "Ian Lyttle told me at the reception that he discovered a bug in rmarkdown but decided not to bother me and figured it out by himself. [...] Anyway, it was so very kind of him!" 🙂  [↪](https://twitter.com/xieyihui/status/1226025372422213632)

<!-- -->

> **Yohan J. Rodríguez** (@hasdid; 1/1): #R  #Automated | Back from rstudio::conf(2020) - My talk, Q&A's, and other conference experiences - Yihui Xie https://t.co/HL4uanLfEK  [↪](https://twitter.com/xieyihui/status/1227393625434263552)

<!-- -->

> **Shannon Pileggi** (@PipingHotData; 1/1): Equally informative and sincere, it is always a pleasure to read posts by @xieyihui.  #rstats 🙏https://t.co/8ZzDBg1SJe  [↪](https://twitter.com/xieyihui/status/1226955914558803968)

<!-- -->


text:
#include "QUICHKDF.h"

#include <cstdio>
#include <cstring>

#include <string_view>

/**
 * HKDF-Expand-Label function of QUIC
 * The HKDF-Expand-Label function and HkdfLabel structure is defined in TLS 1.3 Section 7.1.
 */
int
QUICHKDF::expand(uint8_t *dst, size_t *dst_len, const uint8_t *secret, size_t secret_len, const char *label, size_t label_len,
                 uint16_t length)
{
  // Create HkdfLabel
  uint8_t hkdf_label[512]; // 2 + 255 + 255
  int hkdf_label_len = 0;

  // length field
  hkdf_label[0] = (length >> 8) & 0xFF;
  hkdf_label[1] = length & 0xFF;
  hkdf_label_len += 2;

  // label (prefix + Label) field
  hkdf_label_len += sprintf(reinterpret_cast<char *>(hkdf_label + hkdf_label_len), "%ctls13 %.*s", static_cast<int>(6 + label_len),
                            static_cast<int>(label_len), label);

  // context field
  // XXX: Assuming Context is zero-length character (indicated by "")
  // HkdfLabel requires "0" (length) in context field, because `context<0..255>` is valiable-integer.
  hkdf_label[hkdf_label_len] = 0;
  ++hkdf_label_len;

  HKDF::expand(dst, dst_len, secret, secret_len, hkdf_label, hkdf_label_len, length);

  return 1;
}


text:
package org.caleydo.view.radial;

import org.caleydo.core.data.selection.SelectionType;
import org.caleydo.core.data.selection.events.ISelectionHandler;
import org.caleydo.core.data.selection.events.SelectionUpdateListener;
import org.caleydo.core.event.AEvent;
import org.caleydo.core.event.AEventListener;
import org.caleydo.core.event.EventPublisher;
import org.caleydo.core.event.IListenerOwner;
import org.caleydo.core.event.data.SelectionUpdateEvent;
import org.caleydo.core.manager.GeneralManager;

/**
 * ADataEventManager is the abstract base class for all DataEventManagers, which
 * are responsible to handle and trigger events which are specific for the data
 * type of hierarchical data that is displayed in the radial hierarchy view.
 *
 * @author Christian Partl
 */
public abstract class ADataEventManager implements ISelectionHandler {
	protected SelectionUpdateListener selectionUpdateListener;
	protected GLRadialHierarchy radialHierarchy;
	protected EventPublisher eventPublisher;

	/**
	 * Constructor.
	 *
	 * @param radialHierarchy
	 *            Radial hierarchy view this DataEventManager shall be used for.
	 */
	public ADataEventManager(GLRadialHierarchy radialHierarchy) {
		this.radialHierarchy = radialHierarchy;

		eventPublisher = EventPublisher.INSTANCE;
	}

	/**
	 * Register all event listeners used by the DataEventHandler.
	 */
	@Override
	public void registerEventListeners() {

		selectionUpdateListener = new SelectionUpdateListener();
		selectionUpdateListener.setHandler(this);
		eventPublisher.addListener(SelectionUpdateEvent.class, selectionUpdateListener);

		registerDataSpecificEventListeners();
	}

	/**
	 * Unregister all event listeners used by the DataEventHandler.
	 */
	@Override
	public void unregisterEventListeners() {

		if (selectionUpdateListener != null) {
			eventPublisher.removeListener(selectionUpdateListener);
			selectionUpdateListener = null;
		}

		unregisterDataSpecificEventListeners();
	}

	@Override
	public void queueEvent(AEventListener<? extends IListenerOwner> listener, AEvent event) {
		radialHierarchy.queueEvent(listener, event);
	}

	/**
	 * This method is called when a partial disc of the radial hierarchy view is
	 * selected. It is responsible for triggering all events specific for the
	 * data object the selected partial disc represents.
	 *
	 * @param selectionType
	 *            Type of selection.
	 * @param pdSelected
	 *            Partial disc that has been selected.
	 */
	public abstract void triggerDataSelectionEvents(SelectionType selectionType,
			PartialDisc pdSelected);

	/**
	 * Registers all data type specific event listeners.
	 */
	protected abstract void registerDataSpecificEventListeners();

	/**
	 * Unregisters all data type specific event listeners.
	 */
	protected abstract void unregisterDataSpecificEventListeners();
}


text:
module Core
  class Engine < ::Rails::Engine
    isolate_namespace Core

    # HOWTO  This is a way to make your migrations available in your
    # rails engine.  This has to be done in any engine defining new
    # models.  This is from:
    #
    # http://pivotallabs.com/leave-your-migrations-in-your-rails-engines
    #
    initializer :append_migrations do |app|
      unless app.root.to_s.match(root.to_s)
        config.paths["db/migrate"].expanded.each do |expanded_path|
          app.config.paths["db/migrate"] << expanded_path
        end
      end
    end
  end
end


text:
package org.jruby.java.invokers;

import java.lang.reflect.Field;
import org.jruby.Ruby;
import org.jruby.RubyModule;
import org.jruby.internal.runtime.methods.JavaMethod.JavaMethodOne;
import org.jruby.runtime.Visibility;

public abstract class FieldMethodOne extends JavaMethodOne {
    Field field;
    String name;

    FieldMethodOne(String name, RubyModule host, Field field) {
        super(host, Visibility.PUBLIC);
        if (!Ruby.isSecurityRestricted()) {
            field.setAccessible(true);
        }
        this.field = field;
        this.name = name;
    }
}


text:
package org.yaml.snakeyaml.issues.issue9;

import org.springframework.core.style.ToStringCreator;

public class Bean2 implements IBean {

    private String strVal = "BEAN_2";

    private int intVal = 2;

    public Bean2() {
        super();
    }

    public String getStrVal() {
        return strVal;
    }

    public void setStrVal(String strVal) {
        this.strVal = strVal;
    }

    public int getIntVal() {
        return intVal;
    }

    public void setIntVal(int intVal) {
        this.intVal = intVal;
    }

    @Override
    public String toString() {
        ToStringCreator builder = new ToStringCreator(this);
        builder.append(this.strVal);
        builder.append(this.intVal);
        return builder.toString();
    }

}


text:
/*
 * jobshopConstants.java
 *
 * Created on February 3, 2001, 12:48 PM
 */
package hugs.apps.jobshop;

import java.lang.*;
import java.util.*;
/**
 * This class holds all the constants used in the jobshop project
 *
 * @author  Guy T. Schafer
 * @version 1.0
 */
public class jobshopConstants
{
    // Window titles:
    public final static String TITLE    = "Jobshop Optimizer";
    public final static String TITLE2   = "  v1.0 by Guy T. Schafer";
    public final static String STBTITLE = "Algorithm Server Process ";
    public final static String HISTTITLE= "Solution History";
    public final static String GRPTITLE = "Group Solutions";
    public final static String NAMTITLE = "Group Identifier";

    // Top level menus:
    public final static String FILE     = "File";
    public final static String VIEW     = "View";
    public final static String HIST     = "History";
    public final static String SERVER   = "Servers";
    public final static String MOBIL    = "Mobilities";
    public final static String HELP     = "Help";

    // Tools and Menu Items:
    public final static String OPEN     = "Open";
    public final static String SAVE     = "Save";
    public final static String SAVEAS   = "Save As";
    public final static String EXIT     = "Exit";
//    public final static String TOOLBAR  = "Toolbar";
    public final static String ATTRIB   = "Attributes";
//    public final static String PRIOR    = "Mobility";
    public final static String SHOW     = "Show ";
    public final static String JOBCOL   = "Job Colors";
    public final static String JOBID    = "Job IDs";
    public final static String CHANGE   = "Changes";
    public final static String CRIT     = "Critical Path";
    // The first L here is actually an I so the L in Low
    // is underlined for the menu shortcut:
    public final static String LOW      = "Set seIected to Low Mobility";
    public final static String MED      = "Set selected to Medium Mobility";
    public final static String HIGH     = "Set selected to High Mobility";
    public final static String LOWALL   = "Set all to Low Mobility";
    public final static String MEDALL   = "Set all to Medium Mobility";
    public final static String HIGHALL  = "Set all to High Mobility";
    public final static String DOUBLE   = " (double-click to set all)";
    public final static String SCALE    = "Scale";
    public final static String FIT      = "Fit on page";
    public final static String ZOOMINH  = "Stretch Horizontally";
    public final static String ZOOMOUTH = "Shrink Horizontally";
    public final static String ZOOMINV  = "Stretch Vertically";
    public final static String ZOOMOUTV = "Shrink Vertically";
    public final static String GO       = "Go";
    public final static String STOP     = "Stop";
    public final static String LOOK     = "Display solution / Add solution to history";
    public final static String REL      = "Kill this server process";
    public final static String SPAN     = "Spansize - improving any of these machines is an improvement";
    public final static String PLY      = "Minimum ply - no fewer than this many swaps";
    public final static String UNDO     = "Earlier Solution";
    public final static String REDO     = "Later Solution";
    public final static String PROC     = "Request server process";
    public final static String CONTENTS = "Contents";
    public final static String ABOUT    = "About";
    public final static String CHOOSE   = "Choose search algorithm";
    public final static String SHARE    = "Share this solution with group";

    // Labels for controls:
    public final static String SPANLBL  = "Span ";
    public final static String PLYLBL   = "min ply ";
    public final static String SOLHIST  = " History ";
    public final static String GRPHIST  = " Shared solutions ";
    public final static String GRPID    = " Group ";
    public final static String GRPNAME  = " Name ";
    public final static String GETNAME  = "Enter your name";
    // Some labels are in menus (with dots) and tooltips (without dots):
    public final static String DOTS     = "...";

    // Accelerators:
    public final static char FACC       = 'f';
    public final static char VACC       = 'v';
    public final static char SACC       = 's';
    public final static char HACC       = 'h';
    public final static char OACC       = 'o';
    public final static char AACC       = 'a';
    public final static char XACC       = 'x';
    public final static char IACC       = 'i';
    public final static char GACC       = 'g';
    public final static char TACC       = 't';
    public final static char UACC       = 'u';
    public final static char CACC       = 'c';
    public final static char PACC       = 'p';
    public final static char RACC       = 'r';
    public final static char MACC       = 'm';
    public final static char LACC       = 'l';
    public final static char WACC       = 'w';
    public final static char DACC       = 'd';
    public final static char EACC       = 'e';
    public final static char JACC       = 'j';

    // Status bar has solution history:
    public final static String NOHIST   = "No solutions";

    // Status bar messages:
    public final static String GOSTATUS = "Start server process...";
    public final static String STOPSTATUS = "Stop server process";
    public final static String ENOPROC  = "Server cannot supply more power";
    public final static String FILEOPEN = "File opened";
    public final static String ALERT    = "Better solution found";
    public final static String GRPSTATUS= "New schedule from group";
    public final static String ALGSTATUS= "New schedule from server";
    public final static String SHOWING  = "Showing ";
    public final static String HIDING   = "Hiding ";

    // Group info:
    // The max number of members in each group
    // (Also the max number of groups before the numbers
    // wrap - hopefully, by the time the 10,000th group
    // is created, group 0 is gone.  But if it isn't
    // unpredictable--but bad--behavior will result.)
    public final static int MAXMEMBERS  = 10000;

    // Algorithm names (and count):
    public final static int ALGOCNT     = 3;
    public final static String[] ALGO   = { "Local Greedy",
                                            "Local Deep",
                                            "Tabu Search"
                                          };

    // File Dialog strings:
    public final static String FILTER   = "Jobshop files (*.jsp)";
    public final static String EXT      = ".jobshop";

    // Group Name Input Dialog:
    public final static String CANCEL   = "Cancel";

    // About Dialog strings:
    public final static String COPYRIGHT= "  (c) 2001 Mitsubishi Electric Research Lab";
    public final static String OK       = "OK";

    // Client status messages:
    public final static String CONNORB  = "    Connecting to ORB...";
    public final static String OKORB    = "    Connected to ORB.";
    public final static String ENOORB   = "    ERROR: Failed to acquire ORB. Check tnameserv is running.";
    public final static String CONNALGO = "    Finding Algorithm Server...";
    public final static String OKALGO   = "    Found Algorithm Server.";
    public final static String ENOALGO  = "    ERROR: Failed to find Algorithm Server. Cannot continue.";
    public final static String CONNGROUP= "    Finding Group Server...";
    public final static String OKGROUP  = "    Found Group Server.";
    public final static String MONITOR  = "    Group Monitor Mode ON.";
    public final static String ENOGROUP = "    ERROR: Failed to find Group Server. Cannot be Monitor.";
    public final static String WNOGROUP = "    WARNING: Failed to find Group Server. Working alone...";
    public final static String ENOPACK  = "Invalid move. Cannot pack schedule.";
    // Output file comments:
    public final static String DEFCOM1  = "// MachineCount  JobCount:";
    public final static String DEFCOM2  = "// Each line is a job, data format: {machine# jobDuration}";
    public final static String HISTCOM1 = "// History of solutions:";
    public final static String HISTCOM2 = "// Each line is a job, data format: {machine# jobDuration startTime}";
    public final static String SLBLCOM  = "// Maxspan = ";  // Schedule label comment

    // Critical path (it is either critcal because of job
    // or machine or both so make the flags OR-able):
    public final static int    NOTCR    = 0;
    public final static int    CRJOB    = 1;
    public final static int    CRMACH   = 2;
    // Mobilites:
    public final static int    LOWMOB   = 4;
    public final static int    MEDMOB   = 2;
    public final static int    HIGHMOB  = 1;
    // Flags for menu to tell client to move in history:
    public final static int    NEXT     = -2;
    public final static int    PREV     = -4;
}


text:
import Ember from 'ember';
import moment from 'moment';
import getOwner from 'ember-getowner-polyfill';
import date from '../../helpers/date';
import { moduleFor, test } from 'ember-qunit';
import momentComputed from 'ember-moment/computeds/moment';

moduleFor('ember-moment@computed:moment', {
  setup() {
    this.register('object:empty', Ember.Object.extend({}));
    moment.locale('en');
  }
});

function createSubject(attrs) {
  return getOwner(this).resolveRegistration('object:empty').extend(Ember.$.extend(attrs, {
    container: this.container,
    registry: this.registry
  })).create();
}

test('get', function(assert) {
  assert.expect(1);

  const subject = createSubject.call(this, {
    date: date(0),
    computedDate: momentComputed('date')
  });

  assert.equal(subject.get('computedDate').format('MM/DD/YYYY'), '12/31/1969');
});

test('get and set', function(assert) {
  assert.expect(2);

  const subject = createSubject.call(this, {
    date: date(0),
    computedDate: momentComputed('date')
  });

  assert.equal(subject.get('computedDate').format('MM/DD/YYYY'), '12/31/1969');
  subject.set('date', moment(date(0)).add(1, 'day'));
  assert.equal(subject.get('computedDate').format('MM/DD/YYYY'), '01/01/1970');
});

test('get with literal', function(assert) {
  assert.expect(1);

  const subject = createSubject.call(this, {
    computedDate: momentComputed(date(0))
  });

  assert.equal(subject.get('computedDate').format('MM/DD/YYYY'), '12/31/1969');
});


text:
/**
*
* @author Nikolaos.Kokkinos
* Martikel Nummer: 11052103
* Masterstudiengang Technische Informatik
*/

package krypto.lab2.filesecurity.library.niko.kokkinos;

import java.util.Optional;

import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;

public class CipherHelper {

	private final static String AESCTRPKCS5Padding = "AES/CTR/PKCS5Padding";
	private static final String AESALGORITHM = "AES";
	private final static String ALGORITHMPBKDF2WithHmacSHA1 = "PBKDF2WithHmacSHA1";

	public static Optional<Cipher> tryToInitializeCipher(PBEKeySpec spec, int mode){

		Optional<Cipher> cipher = Optional.empty();

		Optional<SecretKeyFactory> kf = AESUtils.secretKeyfactory.apply(ALGORITHMPBKDF2WithHmacSHA1);

		Optional<byte[]> pbkBytes = AESUtils.generatePbkeyBytes(kf, spec);

		Optional<SecretKeySpec> secretKeySpec = pbkBytes.map((byte[] bytes)->
																			AESUtils.copyOfRange(bytes, 0, (bytes.length)/2))
														.map(k->new SecretKeySpec(k.get(), AESALGORITHM));

		Optional<IvParameterSpec> iv = pbkBytes.map((byte[] bytes)->
																	AESUtils.copyOfRange(bytes, 16, bytes.length))
											   .map(c->new IvParameterSpec(c.get()));

		cipher = AESUtils.cipherInstance.apply(AESCTRPKCS5Padding);

		if(cipher.isPresent() && secretKeySpec.isPresent() && iv.isPresent()){
			AESUtils.initializeCipher(cipher.get()::init,
					  mode,
					  secretKeySpec.get(),
					  iv.get());
		}

		return cipher;
	}

}


text:
#pragma once

#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QDir>

class Editor;
class Diagram;

namespace utils {
	class OutFile;
}

class XmlCompiler
{
public:
	XmlCompiler();
	~XmlCompiler();
	bool compile(const QString &inputXmlFileName, const QString &sourcesRootFolder);
	Editor *loadXmlFile(const QDir &currentDir, const QString &inputXmlFileName);
	Diagram *getDiagram(const QString &diagramName);
	void addResource(const QString &resourceName);

private:
	void generateCode();
	void generateElementClasses();
	void generatePluginHeader();
	void generatePluginSource();
	void generateIncludes(utils::OutFile &out);
	void generateInitPlugin(utils::OutFile &out);
	void generateNameMappings(utils::OutFile &out);
	void generateNodesAndEdgesSets(utils::OutFile &out);
	void generateMouseGestureMap(utils::OutFile &out);
	void generatePropertyMap(utils::OutFile &out);
	void generatePropertyDefaultsMap(utils::OutFile &out);
	void generateDescriptionMappings(utils::OutFile &out);
	void generatePortTypeMappings(utils::OutFile &out);
	void generateParentsMappings(utils::OutFile &out);
	void generateExplosionsMappings(utils::OutFile &out);
	void generateNameMappingsRequests(utils::OutFile &out);
	void generateGraphicalObjectRequest(utils::OutFile &out);
	void generateIsParentOfRequest(utils::OutFile &out);
	void generateGetParentsOfRequest(utils::OutFile &out);
	void generateProperties(utils::OutFile &out);
	void generatePortTypes(utils::OutFile &out);
	void generateReferenceProperties(utils::OutFile &out);
	void generateContainedTypes(utils::OutFile &out);
	void generatePossibleEdges(utils::OutFile &out);
	void generateNodesAndEdges(utils::OutFile &out);
	void generateGroupsXML(utils::OutFile &out);
	void generateEnumValues(utils::OutFile &out);
	void generateEditableEnums(utils::OutFile &out);
	void generateResourceFile();
	void generatePropertyTypesRequests(utils::OutFile &out);
	void generatePropertyDefaultsRequests(utils::OutFile &out);
	void generatePaletteGroupsLists(utils::OutFile &out);
	void generatePaletteGroupsDescriptions(utils::OutFile &out);
	void generateShallPaletteBeSorted(utils::OutFile &out);

	class ListMethodGenerator;
	class PropertiesGenerator;
	class PortsGenerator;
	class ReferencePropertiesGenerator;
	class ContainedTypesGenerator;
	class PossibleEdgesGenerator;
	class EnumValuesGenerator;

	void generateListMethod(utils::OutFile &out, const QString &signature, const ListMethodGenerator &generator);
	void generateStringSet(utils::OutFile &out, const QSet<QString> &set) const;
	void generateStringList(utils::OutFile &out, const QStringList &list) const;
	void generateStringListMap(utils::OutFile &out, const QMap<QString, QStringList> &map) const;

	QMap<QString, Editor *> mEditors;
	QString mPluginName;
	QString mPluginVersion;
	QString mResources;
	QString mCurrentEditor;
	QString mSourcesRootFolder;
};


text:
import { factory } from '../../utils/factory'
import { deepMap } from '../../utils/collection'
import { isInteger } from '../../utils/number'
import { createAlgorithm11 } from '../../type/matrix/utils/algorithm11'
import { createAlgorithm12 } from '../../type/matrix/utils/algorithm12'
import { createAlgorithm14 } from '../../type/matrix/utils/algorithm14'
import { roundNumber } from '../../plain/number'

const NO_INT = 'Number of decimals in function round must be an integer'

const name = 'round'
const dependencies = [
  'typed',
  'matrix',
  'equalScalar',
  'zeros',
  'BigNumber',
  'DenseMatrix'
]

export const createRound = /* #__PURE__ */ factory(name, dependencies, ({ typed, matrix, equalScalar, zeros, BigNumber, DenseMatrix }) => {
  const algorithm11 = createAlgorithm11({ typed, equalScalar })
  const algorithm12 = createAlgorithm12({ typed, DenseMatrix })
  const algorithm14 = createAlgorithm14({ typed })

  /**
   * Round a value towards the nearest integer.
   * For matrices, the function is evaluated element wise.
   *
   * Syntax:
   *
   *    math.round(x)
   *    math.round(x, n)
   *
   * Examples:
   *
   *    math.round(3.2)              // returns number 3
   *    math.round(3.8)              // returns number 4
   *    math.round(-4.2)             // returns number -4
   *    math.round(-4.7)             // returns number -5
   *    math.round(math.pi, 3)       // returns number 3.142
   *    math.round(123.45678, 2)     // returns number 123.46
   *
   *    const c = math.complex(3.2, -2.7)
   *    math.round(c)                // returns Complex 3 - 3i
   *
   *    math.round([3.2, 3.8, -4.7]) // returns Array [3, 4, -5]
   *
   * See also:
   *
   *    ceil, fix, floor
   *
   * @param  {number | BigNumber | Fraction | Complex | Array | Matrix} x  Number to be rounded
   * @param  {number | BigNumber | Array} [n=0]                            Number of decimals
   * @return {number | BigNumber | Fraction | Complex | Array | Matrix} Rounded value
   */
  const round = typed(name, {
    ...roundNumberSignatures,

    Complex: function (x) {
      return x.round()
    },

    'Complex, number': function (x, n) {
      if (n % 1) { throw new TypeError(NO_INT) }

      return x.round(n)
    },

    'Complex, BigNumber': function (x, n) {
      if (!n.isInteger()) { throw new TypeError(NO_INT) }

      const _n = n.toNumber()
      return x.round(_n)
    },

    'number, BigNumber': function (x, n) {
      if (!n.isInteger()) { throw new TypeError(NO_INT) }

      return new BigNumber(x).toDecimalPlaces(n.toNumber())
    },

    BigNumber: function (x) {
      return x.toDecimalPlaces(0)
    },

    'BigNumber, BigNumber': function (x, n) {
      if (!n.isInteger()) { throw new TypeError(NO_INT) }

      return x.toDecimalPlaces(n.toNumber())
    },

    Fraction: function (x) {
      return x.round()
    },

    'Fraction, number': function (x, n) {
      if (n % 1) { throw new TypeError(NO_INT) }
      return x.round(n)
    },

    'Array | Matrix': function (x) {
      // deep map collection, skip zeros since round(0) = 0
      return deepMap(x, round, true)
    },

    'SparseMatrix, number | BigNumber': function (x, y) {
      return algorithm11(x, y, round, false)
    },

    'DenseMatrix, number | BigNumber': function (x, y) {
      return algorithm14(x, y, round, false)
    },

    'number | Complex | BigNumber, SparseMatrix': function (x, y) {
      // check scalar is zero
      if (equalScalar(x, 0)) {
        // do not execute algorithm, result will be a zero matrix
        return zeros(y.size(), y.storage())
      }
      return algorithm12(y, x, round, true)
    },

    'number | Complex | BigNumber, DenseMatrix': function (x, y) {
      // check scalar is zero
      if (equalScalar(x, 0)) {
        // do not execute algorithm, result will be a zero matrix
        return zeros(y.size(), y.storage())
      }
      return algorithm14(y, x, round, true)
    },

    'Array, number | BigNumber': function (x, y) {
      // use matrix implementation
      return algorithm14(matrix(x), y, round, false).valueOf()
    },

    'number | Complex | BigNumber, Array': function (x, y) {
      // use matrix implementation
      return algorithm14(matrix(y), x, round, true).valueOf()
    }
  })

  return round
})

const roundNumberSignatures = {
  number: roundNumber,

  'number, number': function (x, n) {
    if (!isInteger(n)) { throw new TypeError(NO_INT) }
    if (n < 0 || n > 15) { throw new Error('Number of decimals in function round must be in te range of 0-15') }

    return roundNumber(x, n)
  }
}

export const createRoundNumber = /* #__PURE__ */ factory(name, ['typed'], ({ typed }) => {
  return typed(name, roundNumberSignatures)
})


text:
echo "Enter release version: "
read VERSION

read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
    echo "Releasing $VERSION ..."

    # build
    VERSION=$VERSION npm run build

    # # commit
    git add -A
    git commit -m "[build] $VERSION"
    npm version $VERSION --message "[release] $VERSION"

    # # publish
    git push origin refs/tags/v$VERSION
    git push
    npm publish
fi


text:
NS_BEGIN(CORE_NAMESPACE)
  /// can be used as the default value for any type of argument
    struct default_value{
      template<typename T> operator T(){ return T(); }
    };
NS_END(CORE_NAMESPACE)


text:
package org.luizricardo.warppipe;

import java.nio.charset.Charset;

public class WarpFilterConfiguration {

    private final Charset charset;
    private final boolean flushAfterHead;
    private final boolean autoExecuteBeforeClosingBody;
    private final boolean autoDetectPlaceholders;

    public WarpFilterConfiguration(final Charset charset,
                                   final boolean flushAfterHead,
                                   final boolean autoExecuteBeforeClosingBody,
                                   final boolean autoDetectPlaceholders) {
        this.charset = charset;
        this.flushAfterHead = flushAfterHead;
        this.autoExecuteBeforeClosingBody = autoExecuteBeforeClosingBody;
        this.autoDetectPlaceholders = autoDetectPlaceholders;
    }

    public Charset charset() {
        return charset;
    }

    public boolean flushAfterHead() {
        return flushAfterHead;
    }

    public boolean autoExecuteBeforeClosingBody() {
        return autoExecuteBeforeClosingBody;
    }

    public boolean autoDetectPlaceholders() {
        return autoDetectPlaceholders;
    }
}


text:
<?php

namespace Olaoluwa98\Payant\Exceptions;

use Exception;

class ApiRequestError extends Exception
{

}


text:
using System;
using Xunit;

namespace Stubbery.IntegrationTests
{
    public class StateTest
    {
        [Fact]
        public void Start_StartTwice_Exception()
        {
            var sut = new ApiStub();

            sut.Start();

            Assert.Throws<InvalidOperationException>(() => sut.Start());
        }

        [Fact]
        public void Address_NotStarted_Exception()
        {
            var sut = new ApiStub();

            Assert.Throws<InvalidOperationException>(() => sut.Address);
        }
    }
}


text:
<?php
namespace DjThossi\SmokeTestingPhp\Result;

use DjThossi\SmokeTestingPhp\Collection\HeaderCollection;
use DjThossi\SmokeTestingPhp\ValueObject\ErrorMessage;
use DjThossi\SmokeTestingPhp\ValueObject\Url;

class ErrorResult implements Result
{
    /**
     * @var Url
     */
    private $url;

    /**
     * @var HeaderCollection
     */
    private $headers;

    /**
     * @var ErrorMessage
     */
    private $errorMessage;

    /**
     * @param Url $url
     * @param HeaderCollection $headers
     * @param ErrorMessage $errorMessage
     */
    public function __construct(Url $url, HeaderCollection $headers, ErrorMessage $errorMessage)
    {
        $this->url = $url;
        $this->headers = $headers;
        $this->errorMessage = $errorMessage;
    }

    /**
     * @param string $url
     * @param array $headerData
     * @param $errorMessage
     *
     * @return ErrorResult
     */
    public static function fromPrimitives(
        $url,
        array $headerData,
        $errorMessage
    ) {
        return new self(
            new Url($url),
            HeaderCollection::fromArray($headerData),
            new ErrorMessage($errorMessage)
        );
    }

    /**
     * @return string
     */
    public function asString()
    {
        return $this->errorMessage->asString();
    }

    /**
     * @return HeaderCollection
     */
    public function getHeaders()
    {
        return $this->headers;
    }

    /**
     * @return Url
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * @return bool
     */
    public function isValidResult()
    {
        return false;
    }

    public function getTimeToFirstByte()
    {
        throw new NotImplementedException('getTimeToFirstByte is not implemented');
    }

    public function getBody()
    {
        throw new NotImplementedException('getBody is not implemented');
    }

    public function getStatusCode()
    {
        throw new NotImplementedException('getStatusCode is not implemented');
    }
}


text:
var expect = require('chai').expect;
var exists = require('101/exists');
var Model = require('../lib/models/base');
var MockServer = require('./mocks/mock-server');

describe('model has remote changes', function() {
  var server, model, modelModified, modelNotFetched;
  var now = 'Wed Mar 11 2015 13:58:11 GMT-0700 (PDT)',
      later = 'Wed Mar 15 2015 13:58:11 GMT-0700 (PDT)';

  before(function(done) {
    var path = Model.prototype.urlPath = '/resource';
    var attrs = { a: 20, b: 30 };
    server = new MockServer();
    var opts = { client: server.getClient() }

    model = new Model({ _id: '1'}, opts);
    modelModified = new Model({ _id: '2' }, opts);
    modelNotFetched = new Model({ _id: '3'}, opts)

    server.head(path + '/:id', function(req, res) {
      res.set('Last-Modified', (req.params.id == '2') ? later : now);
      res.send();
    });

    server.get(path + '/:id', function(req, res) {
      res.set('Last-Modified', now);
      res.send(attrs);
    });

    server.listen(function(err) {
      if (err) { return done(err); }
      // Prefetch second model so we don't have to do it again in the unit
      modelModified.fetch('2', function(err) {
        if (err) { return done(err); }
        done();
      })
    });
  });

  after(function(done) {
    delete Model.prototype.urlPath;
    server.close();
    done();
  });

  it('should keep track of the Last-Modified header', function (done) {
    model.fetch('1', function(err) {
      if (err) { return done(err); }
      expect(model.lastModified).to.equal(now);
      done();
    });
  });

  it('should report that there are no changes if a resource has not been modified', function (done) {
    model.hasRemoteChanges('1', function(err, changes) {
      if (err) { return done(err); }
      expect(changes).to.be.false;
      done();
    });
  });

  it('should report changes if a resource has been modified', function (done) {
    modelModified.hasRemoteChanges('2', function(err, changes) {
      if (err) { return done(err); }
      expect(changes).to.be.true;
      done();
    });
  });

  it('should throw an error if the model has not been previously fetched', function (done) {
    expect(modelNotFetched.hasRemoteChanges).to.throw(Error);
    done();
  });
});


text:
@interface DLFMasterViewController () <PHPhotoLibraryChangeObserver>

@property NSMutableArray *objects;

@property (strong) NSArray *collectionsFetchResults;
@property (strong) NSArray *collectionsLocalizedTitles;

@property (nonatomic) NSArray *collectionsArrays;

@end

@implementation DLFMasterViewController

static NSString * const AllPhotosReuseIdentifier = @"AllPhotosCell";
static NSString * const CollectionCellReuseIdentifier = @"CollectionCell";

static NSString * const AllPhotosSegue = @"showAllPhotos";
static NSString * const CollectionSegue = @"showCollection";

- (instancetype)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];

        PHFetchOptions *options = [[PHFetchOptions alloc] init];
        [options setSortDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:NSStringFromSelector(@selector(localizedTitle)) ascending:YES]]];
        PHFetchResult *topLevelUserCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:options];
        self.collectionsFetchResults = @[topLevelUserCollections, smartAlbums];
        self.collectionsLocalizedTitles = @[NSLocalizedString(@"Albums", @""), NSLocalizedString(@"Smart Albums", @"")];
        [self excludeEmptyCollections];

        [[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];

        self.title = NSLocalizedString(@"Albums", nil);

        UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) style:UIBarButtonItemStyleDone target:self action:@selector(didTapCancelButton:)];
        [self.navigationItem setLeftBarButtonItem:cancelButton];

        [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:AllPhotosReuseIdentifier];
        [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CollectionCellReuseIdentifier];
        [self.tableView setDataSource:self];
        [self.tableView setDelegate:self];
    }
    return self;
}

- (void)dealloc
{
    [[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];
}

- (void)didTapCancelButton:(id)sender {
    if (self.delegate && [self.delegate respondsToSelector:@selector(masterViewController:didTapCancelButton:)]) {
        [self.delegate masterViewController:self didTapCancelButton:sender];
    }
}

#pragma mark - UIViewController

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    DLFDetailViewController *detailViewController = [[segue.destinationViewController viewControllers] firstObject];
    PHFetchOptions *options = [[PHFetchOptions alloc] init];
    options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
    options.predicate = [NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeImage];
    if ([segue.identifier isEqualToString:AllPhotosSegue]) {
        detailViewController.assetsFetchResults = [PHAsset fetchAssetsWithOptions:options];
        detailViewController.title = NSLocalizedString(@"All Photos", nil);
    } else if ([segue.identifier isEqualToString:CollectionSegue]) {
        NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
        NSArray *fetchResult = self.collectionsArrays[indexPath.section - 1];
        PHCollection *collection = fetchResult[indexPath.row];
        if ([collection isKindOfClass:[PHAssetCollection class]]) {
            PHAssetCollection *assetCollection = (PHAssetCollection *)collection;
            PHFetchResult *assetsFetchResult = [PHAsset fetchAssetsInAssetCollection:assetCollection options:options];
            detailViewController.assetsFetchResults = assetsFetchResult;
            detailViewController.assetCollection = assetCollection;
            detailViewController.title = collection.localizedTitle;
        }
    }
    if (self.delegate) {
        [detailViewController setDelegate:(id)self.delegate];
    }

}

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    DLFDetailViewController *detailViewController = [[DLFDetailViewController alloc] initWithCollectionViewLayout:[[DLFAssetsLayout alloc] init]];
    PHFetchOptions *options = [[PHFetchOptions alloc] init];
    options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
    options.predicate = [NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeImage];
    if (indexPath.section == 0) {
        detailViewController.assetsFetchResults = [PHAsset fetchAssetsWithOptions:options];
        detailViewController.title = NSLocalizedString(@"All Photos", nil);
    } else {
        NSArray *fetchResult = self.collectionsArrays[indexPath.section - 1];
        PHCollection *collection = fetchResult[indexPath.row];
        if ([collection isKindOfClass:[PHAssetCollection class]]) {
            PHAssetCollection *assetCollection = (PHAssetCollection *)collection;
            PHFetchResult *assetsFetchResult = [PHAsset fetchAssetsInAssetCollection:assetCollection options:options];
            detailViewController.assetsFetchResults = assetsFetchResult;
            detailViewController.assetCollection = assetCollection;
            detailViewController.title = collection.localizedTitle;
        }
    }
    if (self.delegate) {
        [detailViewController setDelegate:(id)self.delegate];
    }
    UINavigationController *detailNavVC = [[UINavigationController alloc] initWithRootViewController:detailViewController];
    [self.splitViewController showDetailViewController:detailNavVC sender:nil];
}

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1 + self.collectionsArrays.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSInteger numberOfRows = 0;
    if (section == 0) {
        numberOfRows = 1; // "All Photos" section
    } else {
        NSArray *collections = self.collectionsArrays[section - 1];
        numberOfRows = collections.count;
    }
    return numberOfRows;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    NSString *localizedTitle = nil;

    if (indexPath.section == 0) {
        cell = [tableView dequeueReusableCellWithIdentifier:AllPhotosReuseIdentifier forIndexPath:indexPath];
        localizedTitle = NSLocalizedString(@"All Photos", @"");
    } else {
        cell = [tableView dequeueReusableCellWithIdentifier:CollectionCellReuseIdentifier forIndexPath:indexPath];
        NSArray *results = self.collectionsArrays[indexPath.section - 1];
        PHCollection *collection = results[indexPath.row];
        localizedTitle = collection.localizedTitle;
    }
    cell.textLabel.text = localizedTitle;

    return cell;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    NSString *title = nil;
    if (section > 0) {
        title = self.collectionsLocalizedTitles[section - 1];
    }
    return title;
}

#pragma mark - PHPhotoLibraryChangeObserver

- (void)photoLibraryDidChange:(PHChange *)changeInstance
{
    // Call might come on any background queue. Re-dispatch to the main queue to handle it.
    dispatch_async(dispatch_get_main_queue(), ^{

        NSMutableArray *updatedCollectionsFetchResults = nil;

        for (PHFetchResult *collectionsFetchResult in self.collectionsFetchResults) {
            PHFetchResultChangeDetails *changeDetails = [changeInstance changeDetailsForFetchResult:collectionsFetchResult];
            if (changeDetails) {
                if (!updatedCollectionsFetchResults) {
                    updatedCollectionsFetchResults = [self.collectionsFetchResults mutableCopy];
                }
                [updatedCollectionsFetchResults replaceObjectAtIndex:[self.collectionsFetchResults indexOfObject:collectionsFetchResult] withObject:[changeDetails fetchResultAfterChanges]];
            }
        }

        if (updatedCollectionsFetchResults) {
            self.collectionsFetchResults = updatedCollectionsFetchResults;
            [self excludeEmptyCollections];
            [self.tableView reloadData];
        }

    });
}

- (void)excludeEmptyCollections {
    NSMutableArray *collectionsArray = [NSMutableArray array];
    for (PHFetchResult *result in self.collectionsFetchResults) {
        NSMutableArray *filteredCollections = [NSMutableArray array];
        [result enumerateObjectsUsingBlock:^(PHAssetCollection *obj, NSUInteger idx, BOOL *stop) {
            PHFetchOptions *options = [[PHFetchOptions alloc] init];
            [options setPredicate:[NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeImage]];
            PHFetchResult *countResult = [PHAsset fetchAssetsInAssetCollection:obj options:options];
            if (countResult.count > 0) {
                [filteredCollections addObject:obj];
            }
        }];
        [collectionsArray addObject:filteredCollections];
    }
    self.collectionsArrays = collectionsArray;
}

@end