Thursday, March 30, 2017

Simple ecommerce and shopping cart written in Elm




Repository

https://github.com/lucamug/elm-ecommerce-cart-test

Installation

Clone the repo, run `npm install` and `npm run dev` and accept elm-package's prompt in the cli. Changes to your styles and elm modules under the `src` directory will auto-transpile to css and js respectively.

Based on https://github.com/xavierelopez/elm-cart-example

Wednesday, March 29, 2017

Elm flow in the console

Try this code if you want to see how elm behave in the console:

Wednesday, March 15, 2017

Resources about elm, the programming language

Tuesday, January 24, 2017

Search Testing with React and Redux

I have been working on a Vanilla JS filter that you can find at http://www.rakuten.co.uk/?filter

I am considering about moving to React/Redux so I have made a quick test for the same functionality. I like the idea of one centralised status store. If interested you can find the test at https://github.com/lucamug/search-testing-react-redux

To install the test just clone the repo then run

$ git clone https://github.com/lucamug/search-testing-react-redux.git
$ cd search-testing-react-redux/
$ npm install
$ npm start

Then point the browser to http://localhost:3000/

The test is based on http://jpsierens.com/tutorial-react-redux-webpack/

Sunday, January 15, 2017

Functional Programming - Couple of Videos

Among several videos that I have been watching about functional programming, I found these two quite interesting and entertaining:


Tuesday, January 3, 2017

DEC64 - Douglas Crockford's Decimal Notation

Today, watching an old Douglas Crockford's video I was interested in his proposal of a new way of defining a new number type called DEC64.

Even though I have not enough understand of low level of storing numbers (I guess I studied this stuff at school) I tend to agree to Douglas's idea that application languages should have one numeric type and the type should not behave like:

0.1 + 0.2 === 0.3 // return false

Someone believe that Douglas proposal is not good enough. I believe that one on the goal of the proposal was also to start a discussion about this topic.

I wonder if after two years anybody has implemented this system somewhere.


Monday, January 2, 2017

Bilingual or multilingual blog on Google Blogger

Script to add a language button to set up a bilingual or multilingual blog on Google Blogger.

This way of adding other languages to google bolgger is inspired by http://www.broculos.net/2013/05/how-to-create-multilingual-blog-in.html

You can find a real blog example at http://www.girelloni.com/

Here the script: https://github.com/lucamug/bilingual-google-blogger

Monday, December 19, 2016

Berlin vs. Tokyo

One of the most interisting difference is the street density. I end up walking long distances in Berlin because on the map the distance seemed shorter compared to Tokyo.

Streets Density

Saturday, December 17, 2016

Stairs

Playing with Ricoh Theta


Post from RICOH THETA. - Spherical Image - RICOH THETA

Friday, December 16, 2016

Food pairing

There is a popular article about food pairing: http://www.nature.com/articles/srep00196

The article says that Western cuisines show a tendency to use ingredient pairs that share many flavour compounds, supporting the so-called food pairing hypothesis. By contrast, East Asian cuisines tend to avoid compound sharing ingredients.

But the "food pairing hypothesis" was actually confuted in this sensory test: https://jcunieuws.files.wordpress.com/2008/06/food-pairing.pdf

I am wondering if any progress has been done lately in this field.

In Tuscany, the region I am originally from, we combine these foods:

  • Prosciutto e Melone (Italian Ham and Melon)
  • Salame e Fichi (Tuscany Salami and Figs)
  • Pane e Uva (Bread and Grapes)
  • Cacio e Pere (Pecorino Toscano cheese and Pears)

Radio stations from any corner of the globe

Radio Garden, a nicely crafted website from Studio Puckey in Amsterdam.

Listen to radio stations from any corner of the globe: http://radio.garden/

Thursday, December 8, 2016

How many scripts?

How many pieces of script are running on a page?

I counted them in the HTML Source and in the DOM running the script below in the console for each website.

The number of external Javascript files is from the Console > Network > JS



Saturday, December 3, 2016

The Shape is the Food

During the last trip in Sicily I have been eating often delicious Arancini. The filling can be various, such as Ragu, Cheese and Ham, Egg plants, etc. To guess the content of Arancini they just give them different shape. I wonder if this system could be used also for onigiri. I have always been struggling to guess their content.

Two arancini (foreground and background)

Onigiri at Konbini
And, out of curiosity curiosity, let's see how Google is doing in recognising Arancini shapes:


Google doesn't know yet that Arancini come in multiple shapes.

No luck also with Microsoft's CaptionBot:



This is the full Google's answer:

Tuesday, November 29, 2016

Simple way to embed html in javasript

If you are not working with React and JSX, this could be a quick way to embed html inside Javascript...

Sunday, November 13, 2016

Food Recipes: Semantic representation, Formal Language and Visualization

I always enjoyed the precision that programming languages commands give instructions to computers and I have been wondering if that precision could be applied to food recipes.
If computers could understand semantically a recipe, they would be able to perform many interesting tasks.
For example a computer could
  • Scale the recipe: Not only multiplying ingredients but also adjusting the time and the difficulty
  • Merge recipes fitting one into another taking advantage of the idle moments. It would be possible to plan several recipes with a certain deadline. Something like "I want to prepare Risotto alle Fragole and Arista for 3 people and everything should be ready by 7 pm". This is as example of simplified merging process:
  • Combine recipes to come out with new variation. There is the "Computer Cooking Contest" that is trying to achieve this result. The event is organised every year, see in the resources section for links.
  • Using a version control system, such as Git, where could have people to add variations of the recipe creating branch, merging, committing, etc.
  • Computers could, with the help of a machine or robot, cook for you
This is an example of annotated recipe from the CURD database. This recipe is annotated using the MILK language:

Visualization

If the recipe is semantically represented inside the computer, it could be automatically visualised using some algorithm. A viable format could be similar to:

Other formats:
Video could also be used. Animation could fit better because could be generated in CG. I personally like this point of view in recipe video:
And as a final note, this is a video of my mother that I took several years ago. Not a good example of clarity but... a good recipe:

Resources

  1. A method for extracting major workflow composed of ingredients, tools, and actions from cooking procedural text

    By Yoko Yamakata, Shinji Imahori, Hirokuni Maeta, Shinsuke Mori (2016)
    A method for extracting a major workflow of cooking procedure from a Japanese recipe on the Web. It is utilized for various applications including recipe search, summarization, and visualization.
    http://www.ar.media.kyoto-u.ac.jp/publications/yamakata-CEA16.pdf
  2. Training the PR2 in Culinary Arts. A Natural Language Model for Parsing Recipes

    By Jessica Zhao, Alejandro Bordallo, Subramanian Ramamoorthy (2016)
    a culinary language model for the kitchen by abstracting cooking instructions into a generalized tripartite form of ACTION, TARGET, TOOL.
    http://stanford.edu/~jesszhao/files/PR2cooking.pdf
  3. Predicting the Structure of Cooking Recipes

    By Jermsak Jermsurawong and Nizar Habash (2015)
    An ingredient-instruction dependency tree data structure to represent recipes. The proposed representation allows for more refined comparison of recipes and recipe - parts, and is a step towards semantic representation of recipes
    http://www.aclweb.org/anthology/D/D15/D15-1090.pdf
  4. Flow Graph Corpus from Recipe Texts

    By Shinsuke Mori, Hirokuni Maeta, Yoko Yamakata, Tetsuro Sasada4 (2015)
    An attempt at annotating procedural texts with a flow graph as a representation of understanding.The domain we focus on is cooking recipe.
    https://pdfs.semanticscholar.org/7f88/398e8928d32366ebf725eb457cb2fa3a94bf.pdf