Kirjaudu
Google-sovellukset
Päävalikko
Post a Comment On:
A Nod to Nothing
"Exercises for Programmers: 57 Challenges to Develop Your Coding Skills - Chapter 3, Paint a Room - L-Shaped"
No comments yet. -
1 – 0 of 0
Here it gets a bit more interesting...the goal is L-shaped. I should have let people pick the kind of room and used one app. That's not a difficult mashup.
Fiddle:
https://jsfiddle.net/NodToNothing/7jasm205/
All Fiddles:
https://jsfiddle.net/user/NodToNothing/fiddles/
[Image]
This time the challenge was also to make it accessible via mobile. The nature of Vue is that it works on mobile so I did.....nothing. That's not entirely true, I added /embedded/result to the URL to make it show on the screen.
https://jsfiddle.net/NodToNothing/7jasm205/embedded/result
So here are three screens showing the fiddle working on my mobile phone. Reactive changes working as expected.
[Image]
[Image]
[Image] And some code:
HTML:
Long Wall Width:
Long Wall Heights:
Short Wall Widths:
Short Wall Height:
Paint coverage (square feet per gallon)a:
Square Feet: {{sqFeet}}
Gallons of Paint: {{gallons}}
Javascript + Vue 2.2.1 var app = new Vue({ el: '#app', components: { }, data: { longWidth: 10, longHeight: 10, shortWidth: 5, shortHeight: 5, coverage: 350 }, computed: { gallons: function(){ //return ((this.pizzas * this.slices) % this.people); //the disadvantage of f-ed up long math in line, you lose your place, that took a few iterations return Math.ceil(((this.longWidth * this.longHeight) - (this.shortWidth * this.shortHeight)) / this.coverage); }, sqFeet: function(){ return (this.longWidth * this.longHeight) - (this.shortWidth * this.shortHeight); } } })
posted by Scooter at
2:32 PM
on Mar 10, 2019
Leave your comment
You can use some HTML tags, such as
<b>, <i>, <a>
This blog does not allow anonymous comments.
Comment moderation has been enabled. All comments must be approved by the blog author.
Google Account
You will be asked to sign in after submitting your comment.
Please prove you're not a robot
"Exercises for Programmers: 57 Challenges to Develop Your Coding Skills - Chapter 3, Paint a Room - L-Shaped"
No comments yet. -