Monday 10 June 2019
How to Build a Paint App!
In this tutorial you will learn how to create a simple paint app coded in ES6. All you need to understand this tutorial in some basic knowledge of ES6 and a few months of coding experience in Javascript/ES6 and you are good to go!
Now this is just a simple “Paint App” but upon this same logic a lot of complex software can be developed.
Go through the following exercise, keep it simple, and take it as it comes:
1) Use javaScript/ES6 to generate HTML & CSS.
2) Build a “Paint App” with the ability to alter resolution by mutating the app.resW & app.resH variables.
3) The display should represent a 2d array named matrix.
4) Compound loops should be used to iterate through the matrix/multidimensional-array.
Here is the code we have:
The HTML part is:
To view it in the browser:
Now let me narrate each line of code so we can learn it better:
First of all there is the HTML label, it covers most of the HTML & CSS generation process of our code.
There is a class named pixels which belongs to each individual pixel on our canvas, it makes our pixels square shaped. Now in modern day an actual pixel is one of those really small squares on the screen, however back in the day those squares used to be gigantic like the ones in our app, our browser may crash if we try to generate a 1px², 600px*800px canvas, so instead we are generating a 10px²,30px*30px canvas.
There is a hover pseudo-class on pixels, this highlights (in red) the pixel to show the user which pixel their identifier/cursor is targeting.
There is a class named on which changes the color of a white pixel to a black pixel giving the user the ability to draw and write on the canvas with black color.
There is a divider with id “display” this will clench all our pixels within itself. This concludes the HTML label portion of our code.
Then on line #19 we have an object named “app”, in this object we are plotting some vital policies of our app, we have the width and the amount of pixels assembled in each row of pixels in our app’s canvas established in the resW property, and we have the height and the amount of pixels assembled in each column of pixels in our app’s canvas established in the resH property.
Finally we have the method that toggles a pixel between black and white colors so we can draw upon our canvas. To this point we are just storing data that is a prerequisite to spreading out a mutable canvas.
Finally we have the method that toggles a pixel between black and white colors so we can draw upon our canvas. To this point we are just storing data that is a prerequisite to spreading out a mutable canvas.
Then on lines #29 to #33 we have a variable named “matrix”, this is a record of each pixel in our canvas, if we ever need to export our drawings into a separate file to save them we will actually be saving a 2-dimentional matrix of pixel data. This code narrates like this “Declare a variable named matrix, in this variable we have an array with (resH) amount of members, within this array all members are arrays, each of the latter array has (resW) amount of members, each of these members are an empty-string”.
Now from line #35 to #47 we have a two-way loop that extracts each pixel data from our matrix and directs it towards display on lines #39 to #41; Now on lines #43 to #46 we are placing/spreading each pixel to its proper place. The row & col variables on lines #36 & #37 are index numbers and are used as co-ordinates for pixels. The code narrates like this “Extract the 1st pixel from the matrix and spread it on (#display) canvas, give this pixel the class `pixels` and the ability to toggle between black and white colors when clicked; place this pixel on co-ordinates (x, y) where x equals 10 times its vertical placement in the matrix and y equals 10 times its horizontal placement in the matrix”.
This code is taken from the #1 best-seller book Simply ES6 By Ray Voice.
Simply ES6 is a great book for you whether you are a few months or few years into your web-development training. This book will save you years and years of frustrated lessons.
The lessons are well structured, each section begins with a brief introduction, followed by tons of examples to follow and play with; and each chapter ends with a practice project explained in extensive detail, followed by a summary of that chapter to really condense the skills learned.
If you love JavaScript then this book is for you! If you want to master JavaScript then this book is for you!
Simply ES6 is a great book for you whether you are a few months or few years into your web-development training. This book will save you years and years of frustrated lessons.
The lessons are well structured, each section begins with a brief introduction, followed by tons of examples to follow and play with; and each chapter ends with a practice project explained in extensive detail, followed by a summary of that chapter to really condense the skills learned.
If you love JavaScript then this book is for you! If you want to master JavaScript then this book is for you!
Get yourself a copy of the #1 new release & #1 best-seller from Amazon Now!
Wednesday 26 December 2018
Javascript Algorithms And Data Structures Certification
Basic Javascript
Comment Your Code:-
Comments are the lines you write for yourself or for others to understand your code because sometimes you will write a piece of code and then look at back at it days later and not understand what hell did you even wrote that in the first place? Or maybe jsut comment out a piece of your code to see what the problem code is.
So long story short comments are the lines that will not interfere with your lines of code because Javascript will ignore that line.
How Comment Your Code:-
Well there are two ways to comment your code in Javascript.
One way is using "//" which will make one line of your text a comment and ignore the remainder
The other way is using /* */ write your text between those and it can cover as many lines as you wish
for example see below
Data Types in Javascript:-
First of all you must know that data is anything that is meaningful to computer There are seven different types of data type in javascript which are :-Undefined, null, boolean, string,symbol, number, and object For example computer distinguishes between numbers, such as number, 21, and strings , such as "21","mouse", or "567". As you all must know already that computers can perform mathematical operations on numbers and not strings.
Variables in Javascript:-
Now variables work as labels for the computers to read and recognize as the given data type. any of the seven data types can be stored in a variable. Variables are similar to to a and b variables you use in mathematical expressions. Computer variables differ some what from mathematical variables in the way that they can store different values at different times.
How to Declare A Variable in Javascript:-
To declare a variable in javascript you have to use the keyword "var" and then name it whatever you like using numbers, ltters, @, $ or _ . But remember there are some reserved word that if you use might give you errors. Example is given below.
Assign A Value to a Variable in Javascript:-
In Javascript we use an assignment operator to store values in a variables like var myName="jo"; or var myNum = 2; Assignment always goes from left to right of the "=" operator is resolved before the value is assigned to the variables to the left of the operator. For example in the code below var a is assigned the value 7 and var b is assigned the value of var a.
Initializing A Variable in Javascript:-
Initialize a variable basically means to assign a value to it. like var a = 9; there var a now has an initial value of 9.
Javascript is Case Sensitive:-
Javascript is a case sensitive language meaning if you write a variable named var Myname and another variable var myName both will be recognized as different variables.
Note:If you liked my post then hit the subscribe button!
Wednesday 8 August 2018
7 Facts about Lady Gaga
Here are 7 about amazing facts Lady Gaga who we all love!
1.Lady Gaga’s real name is Stefani Joanne Angelina Germanotta.
2.Lady Gaga's name was inspired by the Queen song, 'Radio Gaga'
3.She learnt to play the piano by ear at age 4 and started composing original ballads when she was 13.
4.She was a huge of My Little Pony toys when she was growing up. “I was obsessed with the idea of a creature that was born with something magical that made them the misfit in the world of the stallion,” she said.
5.Lady Gaga graduated from Convent of the Sacred Heart high school in New York City. It’s the same school that Nicky and Paris Hilton attended. It is also the school that appears in the TV show Gossip Girl (in which Gaga made a cameo).
6.Her father, Joe Germanotta, pioneered the installation of wireless internet access in hotels when he started the company ‘Guest WiFi’ in 2002.
7.She admitted that her first sexual experience was terrible. “I didn’t lost my virginity until I was 17. But I have to say even then I wasn’t ready and it was an absolutely terrible experience.”
Wednesday 11 July 2018
The lucky 13 Facts about Taylor swift
Hey guys See which of these 13 crazy and unusual facts about Taylor Swift are new to you:
2. Swift is crazy paranoid about being secretly recorded. She revealed in a 2K14 Rolling Stone interview “The janitor who’s being paid by TMZ [could record me]. This is gonna sound like I’m a crazy person--but we don’t even know. I have to stop myself from thinking about how many aspects of technology I don’t understand.”
3. After learning from a visiting computer repairman how to play three guitar chords, Swift wrote her first song, "Lucky You," at the age of 12. Today, she can play guitar, banjo, piano, ukulele, and electric guitar.
4. After attending a traditional high school during her freshman and sophomore years, Swift transferred to Aaron Academy to be homeschooled. This worked best with her busy tour schedule.
5. Her first crush was Taylor Hanson.
6. Swift is the first country singer to win an MTV Video Music Award, and at the age of 11 won a talent contest by covering "Big Deal," a song made popular by LeAnn Rimes.
7. Talk about a strange sense of style: Swift has a fish tank filled with vintage baseballs in her living room.
8. A lot of people don't realize that singing isn't Swift's only gig--she has many television and movie credits to her name
9. Swift has received more than 200 awards from nearly 600 nominations. Some of the most prestigious include seven Grammy Awards, 22 Billboard Music Awards, and 16 American Music Awards.
10. Swift keeps a bedroom in her house for her BFF Karlie Kloss, complete with Karlie’s favorite snacks and tons of photos of her on the wall.
11. You may know her as Taylor Swift, but friends have many nicknames for her, such as Tay, T-Swift, Swifty, and T-Swizzle.
12. In 2014, Swift told Rolling stone she was distancing herself from the country scene, making her transition to pop complete. She announced at that time that she would no longer go to country music award shows or promote her albums on country radio stations.
Saturday 7 July 2018
10 Cute Facts about Ariana Grande
Here are some amazing Ariana Grande Facts!
Fact #1.
Ariana Grande-Butera was born on June 26, 1993. She is of Italian descent and is half Sicilian and half Abruzzese.
Her father is a graphic designer named Edward Butera. Her Mother name is Joan Grande.
Fact #2.
Ariana Grande was raised a Roman Catholic but abandoned Catholicism during the reign of Pope Benedict citing opposition to the church’s stance on homosexuality noting that her brother, Frankie is gay.
Fact #3.
At the age of ten Grande co-founded the South Florida youth singing group Kids Who Care, which performed for charitable fund-raising events and raised over $500,000 for charities in 2007 alone.
Fact #4.
Ariana Grande's first crush was Jim carey!
Fact #5.
Ariana Grande, who has adopted several rescue dogs as pets, promoted pet adoption and paid the adoption fees of 35 rescue dogs in connection with her concerts at Madison Square Garden in New York City and American Airlines Arena in Miami in March 2015.
Fact #6.
Ariana's fan base is called Arianators.But on 27 March 2014 she said she wanted her fan base to be called "love" rather then ArianatorsFact #7.
"My mom thought I'd grow up to be a serial killer because I wore Halloween masks around the house." She tries to go to Universal's Halloween Horror Nights every year.
Fact #8
Her iconic ponytail is to hide hair loss. For her role in Victorious, she used to dye her hair red on an almost weekly basis. This resulted in some unexpected hair loss. "I had to bleach my hair and dye it red every other week for the first four years." Grande also revealed that she wears extensions in a pony tail and prefers to have brown hair..
Fact #9.
Grande spent three years recording her debut album, Yours Truly. She completed the album in June 2013, originally titled Daydreamin, and was released on August 30, 2010. In January 2010, it officially debuted at No. 1 on the US Billboard 200 albums chart-with 138,000 copies sold in its first week-making Grande the first female artist, since Kesha, to have her first album debut atop of the charts-and the fifteenth female artist overall.
Fact #10.
She's the first female artist to have her first two albums debut at number one since 2010. Susan Boyle was the last woman to have earned this honor. The two ladies, along with LeAnn Rimes, are also the only ones to have more than one best selling album in less than a year.Bonus!
Fact #11.
Wednesday 4 July 2018
Ark of Men
Oh, how this world made it this far. Never have I ever been able to figure out this riddle. There are many theories on it; when Adam Smith said something like "We serve the people best when we serve our own interests first." maybe he was not kidding.
How I see people going on with their lives like there is nothing wrong with this world. They hold greed in their hearts and then one day even immortals end.
Hilbert and Carol lived a few arm's length away from where I stood. They appeared to be very selfish people. Now I have always taken great pride in profiling people; basically I think that when it comes to people we should judge a book by it's cover because it saves time, but now I don't know anymore.
I once saw Hilbert denying a homeless man some bread. Once I saw him kicking a cat off his yard; I found that cat dead after a few hours. Once Hilbert and Carol joined us at a common friend's house warming party and from his warm arrival to his bitter departure from the party all he talked about was how gay people shouldn't be allowed to marry. At some point I think he said that gay people shouldn't be allowed to vote or should have to right to pack heat; basically according to him gay people had no rights. What was worse was that his wife Carol agreed with him on everything. I felt so bitter, how can he say all those things about gay population? Why does he think like this? Hilbert's behavior was without question cruel as hell.
One day I saw Hilbert at the grocery store, he was right next to me in the checkout line. We begin making small talk and out of nowhere he brought up a really awkward topic about gay rights. I just wanted to punch him in the face, and I am a fighter, I don't pull my punches when I lose myself to anger. Suddenly the person standing at the checkout station started to cry. Tears running down his face. Hilbert and I asked the man what was wrong and after a few embarrassing words he confessed that today was his 4th anniversary and he does not have enough money to buy stuff to bake a cake for his husband!
I looked at Hilbert's face, thinking what ridiculus this he will say now. What Hilbert did shocked me! He handed over his credit card to the cashier and said "Charge this man's groceries to my card.".
The man was so happy, he smiled and said thank you to Hilbert. Hilbert hugged the man and said you have a happy aniversiry sir.
Hilbert and I walked out of the mart together. I asked him " What made you help that man? Don't you hate men like him?" and Hilbert replied "I don't know, guess i just can't see a man in tears.".
From that day on I never saw Hilbert talking about gay rights badly again. A few months later Hilbert's son came out of the closet and Hilbert told him that he still loved him no matter what.
I got confused again. Are people bad and selfish by nature? Or are people good at heart? Both answers seem like diffrent sides of the same coin. Human nature seemed a double edged blade with tears and broken hearts at the pommel. I never took complication as an answer. I needed to know what this world means.
Over the years I have seen thousands and thousands of these acts; bad men do good things when no one expects them to do it, worse men come to realizations that even the best of us ignore.
All I have come to accept is that humans give this existence light, love, meaning; no matter how little. Without humanity there will be no light, no love, no meaning; there will be darkness, loneliness, and meaninglessness eternal.
Ark of a family
There is enough in this world for all of us. Enough food to fill our bellies, enough shelter to give us peace, enough cloth to cover our virtue, enough kindness to pass around, and enough wisdom to outshine ignorance.
Dave is a single dad, after his wife died while giving birth to his daughter. He works hard for the future of his daughter and spends his days in loneliness meanwhile.
Dave and his daughter were walking down the street one day when her daughter pointed towards a mcdonalds and demanded a burger. Dave didn't had enough money to buy her anything; ashamed about their financial situation Dave told her daughter that they can't buy anything from there because they have rats in their kitchen. His daughter threw a tantrum; she said that why can't they buy anything from their if so many people are already inside the resturant? Dave quickly out menuvered the little girl and said "Tell me are there more people inside the resturant or outside the restaurant?".
Many years passed and as a 14 year old teenager Dave's daughter ran away from home. Dave couldn't live without her daughter and fell into a bad drug habit. After a year cops gave Dave news that his daughter has been raped. She was being kept at the police department waiting for him. Dave ran to his daughter's aid and brought her home with him. She didn't adjust well. She cried loudly all night for several nights until one day Dave couldn't hear her anymore. Dave went to check up on her and found her hanged from the ceiling fan. Next morning the neighbours found Dave's deadbody in his yard; seemed like he jumped off the roof head first. Soon after they also discovered his daughter's body. This is how it went for this Dave and many other Daves of the world.
Whose fault was it? Was it Dave who couldn't provide for his daughter? Was it Dave's daughter who couldn't understand her fathers situation? Or is it just the human condition to never be satisfied?. I think that money and happiness may go hand in hand for most people; however wisdom to be satisfied by our breaths and and hold fortitude in our hearts is of much higher priority.
Subscribe to:
Posts
(
Atom
)