GithubHelp home page GithubHelp logo

jayqi / spongebob Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 3.0 884 KB

SPoNgeBOb-CAse cONveRSioN ToOLs

Home Page: https://jayqi.github.io/spongebob/

R 60.33% CSS 0.22% Makefile 1.78% Python 37.68%
r spongebob spongemock meme memes python cli

spongebob's Introduction

spongebob : SPoNgeBOb-CAse cONveRSioN ToOLs

A family of tools for converting text to Mocking SpongeBob case. Available in multiple programming languages.

 -----------------------------------------
| YOu cAn EveN mAkE MaGNiFiCeNT aSCIi arT |
 -----------------------------------------
  \\
   \\    *
          *
     ----//-------
     \..C/--..--/ \   `A
      (@ )  ( @) \  \// |w
       \          \  \---/
        HGGGGGGG    \    /`
        V `---------`--'
            <<    <<
           ###   ###
Language Package Available From Tests Coverage
CLI spongebobsay PyPI tests-spongebobsay-cli codecov
Python spongebobcase PyPI tests-py-pkg codecov
R spongebob CRAN_Status_Badge CRAN_Download_Badge tests-r-pkg codecov

For usage and installation instructions, see the READMEs for individual packages.

insPIreD bY A twiTTeR CoNVErsaTIon StArtED By @jONgAllOwaY.


The author of this package claims no ownership over SpongeBob SquarePants. SpongeBob SquarePants is the creation of Stephen Hillenburg, and its trademark is owned by Viacom International Inc. This package uses SpongeBob under fair use, and this package should only be used for personal, noncommercial purposes.

spongebob's People

Contributors

jayqi avatar wdearden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spongebob's Issues

tospongebob.ggplot doesn't preserve groups with `fill`, `color`, etc.

library(tvthemes)
library(magrittr)
library(ggplot2)
library(spongebob)

spongebob_plot <- mpg %>%
    ggplot(aes(displ, fill = class)) +
    geom_histogram(col = "black", size = 0.1) +
    labs(
        title = "F is for Fire that burns down the whole town!"
        , subtitle = "U is for Uranium... bombs! N is for No survivors when you're-"
        , caption = "Plankton, those things aren't what fun is about!"
    ) +
    theme_spongeBob(
        title.font = "Some Time Later"
        , text.font = "Some Time Later"
        , title.size = 22
        , subtitle.size = 16
        , axis.title.size = 16
        , axis.text.size = 14
        , legend.title.size = 14
    ) +
    scale_fill_spongeBob()

spongebob_plot2 <- tospongebob(spongebob_plot)

tospongebob(spongebob_plot) gives the following warning

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning message:
This manual palette can handle a maximum of 9 values. You have supplied 150. 

The issue is the same string can get recoded in many different ways. The easiest solution which avoids digging into ggplot details would be to add an option to tospongebob.character to map identical strings in a vector in the same way. I will fix this issue.

spongebobsay function

Inspired by cowsay, we could have a function that has an ASCII version of the Mocking Spongebob meme and also converts the input text with tospongebob

Meme image generator function

Generate a meme image with the Mocking Spongebob image with the text passed through tospongebob.

Do we include the image as part of the package? Or is there an IP concern?

Alternatively, the function could act as a client to an online meme generator service for this very specialized use case. Here is an example of a package that tries to do that.

Thanks to @skirmer for the idea.

Add some input validation to .make_ascii_maker

There are some assumptions by .make_ascii_maker around the inputs. To be safe, it would be great to have some input validation there. If we want to maintain 100% code coverage, we'd also have to write tests.

For now this is an internal function so it's not a huge priority. It's a pain to validate (and then test the validation) for 3 different conditions on these 5 inputs. Maybe a good code-golfing exercise.

Make a function to wrap fortunes

The fortunes::fortune() function unfortunately returns an object with a complex interface:

str(fortunes::fortune())
#> List of 5
#>  $ quote  : chr "It's not meant for sampling weights. It's meant for precision weights. How best to include sampling weights in "| __truncated__
#>  $ author : chr "Thomas Lumley"
#>  $ context: chr "in reponse to a question about specifying sampling weights in lme4"
#>  $ source : chr "R-help"
#>  $ date   : chr "January 2012"
#>  - attr(*, "row.names")= int 307
#>  - attr(*, "class")= chr "fortune"

Created on 2019-01-31 by the reprex package (v0.2.1)

The documentation also isn't great, which makes it kludgy to use if you don't remember its class variables. We could make a function like spongebob_fortune that does something like:

f <- fortunes::fortune()
paste0(f$quote, "  -", f$author)

Other packages like praise::praise() don't have this problem because they simply return a character string, so we can just provide simple examples in a vignette, per #4.

spongebobsay say incorrectly formats speech bubble when using UTF-8 characters > 1 byte

When using certain Unicode characters, the spongebobsay family of functions will incorrectly whitespace pad to form the beech bubble.

To reproduce:

library(spongebob)
foo <- paste(
    paste0("pokémon", paste(rep(".", 25), collapse = ""))
    , paste0("pokemon", paste(rep(".", 30), collapse = ""))
)
cat(spongebobsay(foo))
#>  --------------------------------------- 
#> | poKémOn.........................     |
#> | pokEMOn.............................. |
#>  --------------------------------------- 
#>   \\
#>    \\    *
#>           *
#>      ----//-------
#>      \..C/--..--/ \   `A
#>       (@ )  ( @) \  \// |w
#>        \          \  \---/
#>         HGGGGGGG    \    /`
#>         V `---------`--'
#>             <<    <<
#>            ###   ###

Created on 2019-02-03 by the reprex package (v0.2.1)

The problem is because we are using sprintf under the hood here. For example, the format code %-35s says to print a string and then pad with whitespace on the right to have fill fixed width of 35.

Unfortunately, sprintf documentation says:

Field widths and precisions of %s conversions are interpreted as bytes, not characters, as described in the C standard.

Which is also what is found in the POSIX standard.

This means that any UTF-8 character that is represented by more than 1 byte will have its width incorrectly counted by sprintf.

We'll need an alternative way to pad strings with whitespace that counts characters rather than bytes, possibly a custom function.

(Note: for a good primer on character encodings, read Joel Spolsky's seminal article.)

Speech bubbles deserve corners

Hi @jayqi ,

Thanks for this package; it's really helped me advance in my work.

I think Spongebob's speech bubbles deserve to look a bit nicer with corners. This wikipedia page points out some great ASCII characters that can create nice-looking ASCII boxes. I've used some in slaph.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.