Giter Site home page Giter Site logo

flair's Introduction

Old Fashioned

This is the software behind oldfashioned.tech. Given the, um, fast pace of development, there's a little sawdust on the shop floor, so to speak. So, the application is in /front.

It's written in Elm, a lovely new language, and importantly uses elm-ui, a very futuristic UI library. So it's a little different than most web apps, but on the bright side, this really fits into the Elm model super well, and also the data representation is super approachable.

Set up

To get set up:

Then install create-elm-app globally:

npm install create-elm-app -g

Then, once you've cloned this git repository, go into the front directory, and run

elm-app start

The lay of the land

There's a smidge of 'modularization', in this case, basically moving things into files. The files are:

  • Main.elm: the interface
  • Quantity.elm: a system for representing quantities
  • Icons.elm: um… icons
  • Data.elm: all the recipes and stuff

A few concepts to get out of the way:

I refer to substances, like "Vodka", as Materials. This is because just "Vodka" is not an ingredient: 6 Cl of Vodka is an ingredient.

Quantities are kind of fancy, they use Elm types! Some example quantities:

Dashes 2
FewDashes
CL 2

Same with glasses - there's a type for each kind of glass.

Note that all of the 'liquid' quantities are measured in CL, or Centiliters, because that's what Wikipedia uses. We convert to all the other measures on the frontend.

So a recipe looks like this, and goes in a long list in Data.elm

-- https://en.wikipedia.org/wiki/Sour_(cocktail)#White_Lady
{ name = "White lady"
  , ingredients =
        [ { material = gin, quantity = CL 4 }
        , { material = tripleSec, quantity = CL 3 }
        , { material = lemonJuice, quantity = CL 2 }
        ]
  , description = """Add all ingredients into cocktail shaker filled with ice. Shake well and strain into large cocktail glass."""
  , glass = Cocktail
  }

Really, making recipes, Elm will usually tell you exactly what's wrong, which is really neat.

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.