Skip to content

Commit

Permalink
elm photo app
Browse files Browse the repository at this point in the history
  • Loading branch information
rasheedmhd committed Aug 1, 2024
1 parent f265dbf commit d2e6c38
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 0 deletions.
Binary file added elm/Groove/elm-stuff/0.19.1/PhotoGroove.elmi
Binary file not shown.
Binary file added elm/Groove/elm-stuff/0.19.1/PhotoGroove.elmo
Binary file not shown.
Binary file added elm/Groove/elm-stuff/0.19.1/d.dat
Binary file not shown.
Binary file added elm/Groove/elm-stuff/0.19.1/i.dat
Binary file not shown.
Empty file.
Binary file added elm/Groove/elm-stuff/0.19.1/o.dat
Binary file not shown.
24 changes: 24 additions & 0 deletions elm/Groove/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0"
},
"indirect": {
"elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.3"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
27 changes: 27 additions & 0 deletions elm/Groove/src/PhotoGroove.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-- Comments
-- Functions that create elements take exactly 2 arguments
-- fn_that_creates_elems [ls_of_attrs] [ls_of_DOM_nodes]
-- 1. A list of attributes
-- 2. A list of DOM Nodes
-- One of the args can empty so we get this
-- 1. h1 [] [ text "Photo Groove" ]
-- 2. img [ src "1.jpeg" ] []
-- or even both empty
-- br [] []
module PhotoGroove exposing (main)

import Html exposing (div, h1, img, text)
import Html.Attributes exposing (..)

view model =
div [ class "content" ]
[h1 [] [text "Photo Groove" ]
, div [ id "thumbnails" ]
[ img [ src "http://elm-in-action.com/1.jpeg" ] []
, img [ src "http://elm-in-action.com/2.jpeg" ] []
, img [ src "http://elm-in-action.com/3.jpeg" ] []
]
]

main =
view "no model yet"
52 changes: 52 additions & 0 deletions go/ch2/t.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Example 2-2. Type conversions

package main

import "fmt"

// Immutable variables
const cx int64 = 10

const (
idKey = "id"
nameKey = "name"
)
const z = 20 * 10

func main() {

var x int = 10
var y float64 = 30.2
var sum1 float64 = float64(x) + y
var sum2 int = x + int(y)
fmt.Println(sum1, sum2)

var xx int = 10
var b byte = 100
var sum3 int = xx + int(b)
var sum4 byte = byte(x) + b
fmt.Println(sum3, sum4)

// Go doesn’t provide a way to specify that a value calculated at runtime is
x2 := 5
y2 := 10
const z = x2 + y2

const cy = "hello"
fmt.Println(cx)
fmt.Println(cy)
cx = cx + 1 // this will not compile!
cy = "bye" // this will not compile!

}

// Constants in Go are a way to give names to literals.
// They can only hold values that the compiler can figure out at compile time.
//
// This means that they can be assigned:
// • Numeric literals
// • true and false
// • Strings
// • Runes
// • The values returned by the built-in functions complex, real, imag, len, and cap
// • Expressions that consist of operators and the preceding values

0 comments on commit d2e6c38

Please sign in to comment.