Skip to content

Instantly share code, notes, and snippets.

module Main exposing (main)
import Element exposing (..)
import Html exposing (Html)
foo =
(+) 3 << (+) 2
@lucamug
lucamug / main.03.elm
Created April 29, 2017 09:08
Tutorial - How to recycle in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Array
type alias Product =
{ name : String
@lucamug
lucamug / main.02.elm
Last active April 29, 2017 08:30
Tutorial - How to recycle in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type alias Model =
{ name : String
, price : Float
@lucamug
lucamug / main.01.elm
Created April 29, 2017 08:22
Tutorial - How to recycle in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type alias Model =
{ name : String
, price : Float
@lucamug
lucamug / main.01.elm
Created April 28, 2017 19:40
Recycling in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
type alias Model =
{ name : String
, price : Float
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
-- import Debug exposing (..)
main =
Html.beginnerProgram
{
"title": "Test for Javascript",
"orderedSheetsTitle": [
"Sheet1",
"Sheet2",
"Sheet3"
],
"orderedSheetsId": [
"od6",
"o1anaj",
"use strict";
let downloadGoogleSpreadsheet = require("./downloadGoogleSpreadsheet");
downloadGoogleSpreadsheet("1Wl4MriZ-4HM_DmXWxHyH7Xt2VKoRPK3RfCji_KhFa7U", (data) => {
console.log(JSON.stringify(data, null, "\t"));
});
@lucamug
lucamug / downloadGoogleSpreadsheet.js
Last active January 16, 2017 20:32
Javascript snippet to download a Google Spreadsheet that as multiple worksheets in JSON
"use strict";
let request = require("request");
let organizeData = (feed) => {
// Parse data as it comes from Google Spreadsheet and
// reorganize it in a simplified data structure
let entry = feed.entry,
r = {
title: $t(feed, "title"),
orderedSheetsTitle: [],
orderedSheetsId: [],
{
"labelAnnotations": [{
"mid": "/m/02wbm",
"description": "Food",
"score": 92
}, {
"mid": "/m/02q08p0",
"description": "Dish",
"score": 86
}, {