<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nicholas Fazzolari</title>
    <description>The latest articles on DEV Community by Nicholas Fazzolari (@nickfazzpdx).</description>
    <link>https://dev.to/nickfazzpdx</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F59776%2Fe59fa48d-2a6f-4d3e-8ad8-0fa25bdb2d1b.jpg</url>
      <title>DEV Community: Nicholas Fazzolari</title>
      <link>https://dev.to/nickfazzpdx</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nickfazzpdx"/>
    <language>en</language>
    <item>
      <title>Using Maps and the @each Rule in SASS to Create Ranged Classes</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Mon, 25 Jan 2021 02:31:53 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/using-maps-and-the-each-rule-in-sass-to-create-ranged-classes-1hc0</link>
      <guid>https://dev.to/nickfazzpdx/using-maps-and-the-each-rule-in-sass-to-create-ranged-classes-1hc0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article is intended for front-end developers who understand the fundamentals of SASS CSS preprocessing syntax and concepts, and are interested in using code generating SASS features to build ranged CSS classes using available data structures and looping mechanisms within the SASS preprocessor standard library.&lt;/p&gt;

&lt;p&gt;As the scope and complexity of front-end, web development increases us front-end web developers constantly have to find tools that help us become more efficient in our development. SASS provides us with multiple core features to help us keep our code DRY (Do not Repeat Yourself). The features we're going to be exploring with two basic examples in this article are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SASS Map &lt;a href="https://sass-lang.com/documentation/values/maps" rel="noopener noreferrer"&gt;(See official documentation)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;SASS @each rule &lt;a href="https://sass-lang.com/documentation/at-rules/control/each" rel="noopener noreferrer"&gt;(See official documentation)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Maps in a Nutshell
&lt;/h2&gt;

&lt;p&gt;Maps are a data structure provided by SASS that follow the &lt;code&gt;(&amp;lt;expression&amp;gt;: &amp;lt;expression&amp;gt;, &amp;lt;expression&amp;gt;: &amp;lt;expression&amp;gt;)&lt;/code&gt; key:value mapping rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  @each in a Nutshell
&lt;/h2&gt;

&lt;p&gt;@each is one of a few looping mechanisms provided by SASS which allows for iteration over lists and maps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context
&lt;/h2&gt;

&lt;p&gt;Let's say you're building out a front-end for a project and you have CSS classes which are ranged in nature. For example, you need a five levels of opacity that need to be represented as discrete CSS classes.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;0%, 25%, 50%, 75%, 100% (default)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The classes can be implemented as pure CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sure, you can write these by hand and move on with life. However, if you want to have a more defined step that includes 8 levels of opacity you'll be stuck re-writing the classes by hand. It's error prone and not maintainable. Let's use the mechanisms which SASS provides us to make the code more terse and maintainable using maps and @each.&lt;/p&gt;

&lt;h2&gt;
  
  
  SASS-ified Ranged Opacity Example
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Defining the Map
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// opacity map&lt;/span&gt;
&lt;span class="nx"&gt;$opacityMap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;50&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;75&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;100&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have a SASS variable which stores the map. We can now write the code which iterates over the contents of the map and generates resulting CSS:&lt;/p&gt;

&lt;h4&gt;
  
  
  Using @each to Generate the Opacity Classes
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// generates ranged opacity classes based on the values in the opacity map&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;each&lt;/span&gt; &lt;span class="nx"&gt;$key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;$value&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;$opacityMap&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;$key&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break the code down.&lt;br&gt;
We told the SASS preprocessor to take each &lt;code&gt;$key&lt;/code&gt;, and &lt;code&gt;$value&lt;/code&gt; in the map &lt;code&gt;$opacityMap&lt;/code&gt; and make a CSS classed named &lt;code&gt;.opac-0 ... n&lt;/code&gt;, with &lt;code&gt;opacity: $value 0 ... k&lt;/code&gt; as their rules. The SASS preprocessor will continue the loop @each until the end of the map is reached giving us the following CSS output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;75&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opac&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;When learning CSS preprocessing it can be easy to stop learning after the features at mixins and variables functionality, with the occasional &lt;a class="mentioned-user" href="https://dev.to/use"&gt;@use&lt;/a&gt; or @extend. Becoming a master at your craft means to always forge ahead and learn more. Remember, if you find yourself writing ranged CSS classes stop and take a few minutes to consider if you can use iteration and data containers to build a faster, safer and more maintainable solution. I hope this article helped some of you learning SASS to come up with creative ways to write better CSS.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Reaching Out - Worries About my Journey as a Developer so Far</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Mon, 15 Apr 2019 17:08:53 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/reaching-out-worries-about-my-journey-as-a-developer-so-far-4k7b</link>
      <guid>https://dev.to/nickfazzpdx/reaching-out-worries-about-my-journey-as-a-developer-so-far-4k7b</guid>
      <description>&lt;p&gt;Hi fellow Devs. I'm nearing the completion of my Computer-Science degree and am feeling rather lost, worried, and lonely in the world of development. I started college at 29 to change my career path from food service and live music to becoming a web/application developer. When I was younger I decided to delay my college education until later in life. Some reasons included family finance, having a secure job and a successful band which was allowing me to live my youthful dream of touring in a band and bringing my creative output to people. I went and toured the world with my punk band and made great connections there and found a lot of fulfillment and still preform from time to time. However, the music scene operates too late at night with too much partying so I'm off boarding from it quite a lot. This is leaving a huge scary void in my life.&lt;/p&gt;

&lt;p&gt;My decision to attend college for CS was not an arbitrary choice. I began writing web sites in 1999, made Quake2 maps and stayed active with graphic design work in my adventures as a musician. We made all our art and products ourselves, 100% DIY. I love creating things in the digital domain and have had some success in doing so. I've been actively working on translating all the skills I've gained throughout my life to software development, which has shown some positive results from what I can measure.&lt;/p&gt;

&lt;p&gt;Throughout my education I have managed to transition into a part-time IT job and am getting occasional freelance work as a web developer/digital designer. It seems like I've learned a lot of really valuable software development skills and theories, and have become a far better developer and problem solver due to my education. However, something feels like it's missing.&lt;/p&gt;

&lt;p&gt;After doing some thinking I figured out what it is that is missing. I'm in need of a mentor. I am eager to be part of a community. I want to get involved! I have more time as my classes are mainly electives. I'm finding it difficult to navigate it all. I'm a social person and love being part of communities.&lt;/p&gt;

&lt;p&gt;Any advice would be greatly appreciated.&lt;/p&gt;

</description>
      <category>career</category>
      <category>help</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Help! I am Overwhelmed With React and It's Preventing Me From Finding A Workflow</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Sat, 05 Jan 2019 00:48:04 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/help-i-am-overwhelmed-with-react-and-its-preventing-me-from-finding-a-workflow-41ng</link>
      <guid>https://dev.to/nickfazzpdx/help-i-am-overwhelmed-with-react-and-its-preventing-me-from-finding-a-workflow-41ng</guid>
      <description>&lt;h2&gt;
  
  
  A Short Background Story
&lt;/h2&gt;

&lt;p&gt;I've been making websites since the late 1990's. I took a break between 2007 and 2014 and the web development ecosystem has changed &lt;em&gt;a lot&lt;/em&gt; to say the least. I've always used a workflow that to me has been rather clear and has served my purposes.&lt;/p&gt;

&lt;h4&gt;
  
  
  What I'm Used to:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;JavaScript (for effects and interaction)&lt;/li&gt;
&lt;li&gt;CSS

&lt;ul&gt;
&lt;li&gt;I added SASS to this in 2014/2015&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;A php driven CMS &lt;em&gt;(Craft/Perch lately)&lt;/em&gt; and PhPMyAdmin to manage my SQL&lt;/li&gt;

&lt;li&gt;A shared hosting solution (1and1) that I can point domains to and store data on&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;With those technologies I would make templates that rendered the content from the CMS. My clients have been happy with this approach and I can deliver solutions using that workflow. However, I started paying attention to the React/GraphQL movement in the last year. As of late I've been zeroing in on Gatsby.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I've Done To Understand and Learn
&lt;/h2&gt;

&lt;p&gt;I've gone through the React tutorial on their site, same with the GraphQL tutorial, have read and understood the granular topics of what these technologies are. I've familiarized myself with package managers.&lt;/p&gt;

&lt;p&gt;Through my formal CS education I have written a text editor in Assembly, written and IPC in C, but I'm more confused and frustrated building a portfolio site with react (focusing on Gatsby as my stack) and have nothing to show dozens of hours into the process. I constantly feel lost in dozens of topics that are partially explained without connection to the other related topics. I feel like I'm drowning in sales pitches of competing framework developers who all want me to try their &lt;em&gt;awesome&lt;/em&gt; new technology that all do the same thing - the same thing? WHAT IS IT? I want to make awesome web sites. I want to go from design to a public facing website that I created with this technology.&lt;/p&gt;

&lt;p&gt;I don't like being this cynical. I prefer to be productive and optimistic. &lt;strong&gt;I feel drained, frustrated and used.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking Within Myself
&lt;/h2&gt;

&lt;p&gt;I'm rational enough to understand that if industry leaders are using these new web development technologies to their benefit, I must be approaching this wrong. I'm not thinking about it right. I've exhausted my own resources as an independent learner. Halp!&lt;/p&gt;

&lt;h2&gt;
  
  
  Breaking Down And Asking For Help
&lt;/h2&gt;

&lt;p&gt;At this point I'm breaking down and asking for help. I've tried finding a block diagram of flow chart of a high-level overview how to use react and various technologies that are dependent on it &lt;em&gt;(whatever those are at any given moment in time)&lt;/em&gt; and haven't found anything.&lt;/p&gt;

&lt;h4&gt;
  
  
  Core Questions I have
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hosting (public facing)? I can't install packages onto my shared hosting plan on the fly. I can't ssh into it. No root access. What do I use instead? Do I run a server here at my house?&lt;/li&gt;
&lt;li&gt;Is the core React library alone not powerful enough? Do I need to install a CMS or other packages for react to be &lt;em&gt;useful&lt;/em&gt;, much how php on it's own doesn't provide all the abstractions needed for task x, y and z?&lt;/li&gt;
&lt;li&gt;The most important: What (preferably free) tutorials/learning resources do you recommend? Maybe my searches haven't returned the best results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for listening to my vent post. I'm reaching out for mentorship and help. Anything help/guidance would be appreciated.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you enjoyed this content and want to support a poor freelancing student so I can eat and produce more content in the future, I accept donations via &lt;a href="https://paypal.me/btsourcepdx" rel="noopener noreferrer"&gt;PayPal&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>help</category>
      <category>webdev</category>
      <category>discuss</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Generate and Set Pseudorandom Hexadecimal Background Color Using JavaScript</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Sat, 22 Dec 2018 08:18:35 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/generate-and-set-pseudorandom-hexadecimal-background-color-using-javascript-hi7</link>
      <guid>https://dev.to/nickfazzpdx/generate-and-set-pseudorandom-hexadecimal-background-color-using-javascript-hi7</guid>
      <description>&lt;p&gt;I'm working on a project that deals with pseudo random event-driven color changes and needed a solution to generate hexadecimal codes for web use.&lt;/p&gt;

&lt;h1&gt;
  
  
  Program Design and Thinking:
&lt;/h1&gt;

&lt;p&gt;I know that hexadecimal color codes represent red green and blue values in base 16. Which are defined by the following pattern:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbtsource.net%2Fdev_to_images%2Frgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbtsource.net%2Fdev_to_images%2Frgb.png" alt="Hexadecimal number explanation" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started thinking about what type and data structure to use in the implementation. I cam up with a general idea using a sets to define the base set and a general rule to build a six value hexadecimal color code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Where H is the set of hex values&lt;/strong&gt; - These will be defined as strings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The set 'Hexadecimal Color Code'&lt;/strong&gt; - uses &lt;code&gt;+=&lt;/code&gt;, the operator from JavaScript to concatenate a range of values from &lt;em&gt;H&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbtsource.net%2Fdev_to_images%2Fhexset.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbtsource.net%2Fdev_to_images%2Fhexset.png" alt="General outline of how to build hex codes" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point I was able to start writing some code. I will let the code speak for itself in the embed below.&lt;/p&gt;

&lt;h1&gt;
  
  
  Discussion and Insight:
&lt;/h1&gt;

&lt;p&gt;As a Computer Science student and total nerd I have a question about this code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can these values be generated totally numerically, then parsed as strings after generation? I know in C/C++ &lt;em&gt;(my coding comfort zone)&lt;/em&gt; you can do this. With my current knowledge of JavaScript I have yet to discover a method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Any other insights or comments would be appreciated.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Code
&lt;/h1&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/NickersF/embed/QzpYGK?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Taking it Further:
&lt;/h1&gt;

&lt;p&gt;After I implemented this I started thinking about doing more complex and potentially useful things with hex colors. For example, one could build on this idea and implement the code in such a way that only the &lt;code&gt;R&lt;/code&gt;, &lt;code&gt;G&lt;/code&gt;, or &lt;code&gt;B&lt;/code&gt; get generated or a certain combination of the three.&lt;/p&gt;

&lt;p&gt;Anyways, I hope some discussion arises from this, and this post was interesting.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you enjoyed this content and want to support a poor freelancing student so I can eat and produce more content in the future, I accept donations via &lt;a href="https://paypal.me/btsourcepdx" rel="noopener noreferrer"&gt;PayPal&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>showdev</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Using 'null' in SASS/SCSS Mixins to Mute Arguments</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Tue, 18 Dec 2018 03:58:08 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/using-null-in-sassscss-mixins-to-mute-arguments-6oa</link>
      <guid>https://dev.to/nickfazzpdx/using-null-in-sassscss-mixins-to-mute-arguments-6oa</guid>
      <description>&lt;h1&gt;
  
  
  The Discovery
&lt;/h1&gt;

&lt;p&gt;I'm working on styling some boxes, something front-end web developers are (&lt;em&gt;should&lt;/em&gt;) be familiar with. I use SASS to write my CSS. I needed some rounded corners so I wrote a mixin that looks like this:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h1&gt;
  
  
  The Issue &amp;amp; Dirty Solution
&lt;/h1&gt;

&lt;p&gt;I included the mixin in a CSS class to see my result.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;In the browser the result was what I expected. Eight pixel rounded borders on my box. However, for one of the boxes I was working on I only needed the &lt;code&gt;top-left&lt;/code&gt; and &lt;code&gt;top-right&lt;/code&gt; corners rounded so I set the &lt;code&gt;bottom-left&lt;/code&gt; and &lt;code&gt;bottom-right&lt;/code&gt; arguments to &lt;code&gt;0px&lt;/code&gt; and again, the result was correct in the browser; sharp bottom corners and nice eight pixel rounded top borders. Oh yeah, the CSS compiled without errors too.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h1&gt;
  
  
  The Optimization
&lt;/h1&gt;

&lt;p&gt;I do my best to work in a &lt;em&gt;mobile first mindset&lt;/em&gt;, I value optimization and performance. With my rudimentary understanding of the compilation process from SASS to CSS I suspected that setting the arguments of the mixin to a &lt;code&gt;0px&lt;/code&gt; value would keep the two unneeded CSS rules in the compiled CSS.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I was right.&lt;/p&gt;

&lt;p&gt;This could add up quickly and generated many extra line of CSS that are not needed. I decided to test something, something I have picked up during my CS education: &lt;strong&gt;Try &lt;code&gt;null&lt;/code&gt; and see what happens&lt;/strong&gt; in a situation like this. &lt;code&gt;null&lt;/code&gt; appears in many programming and scripting languages and can be powerful in the right situations.&lt;/p&gt;

&lt;p&gt;I changed my include to this:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;and compiled the code. No error! Being somewhat proud of myself and excited I looked into the compiled .css file and found the following (&lt;em&gt;and desired&lt;/em&gt;) result:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;For this example we ended up with two less lines of CSS. However, at scale this could save thousands of lines of unneeded CSS. This also makes minifying more rewarding.&lt;/p&gt;

&lt;p&gt;I hope this was useful for some people who like squeezing more optimization out of their front-end code.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;If you enjoyed this content and want to support a poor freelancing student so I can eat and produce more content in the future, I accept donations via &lt;a href="https://paypal.me/btsourcepdx" rel="noopener noreferrer"&gt;PayPal&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>sass</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What are Some Common Use Cases for DLL's in Windows Applications</title>
      <dc:creator>Nicholas Fazzolari</dc:creator>
      <pubDate>Thu, 26 Jul 2018 16:16:29 +0000</pubDate>
      <link>https://dev.to/nickfazzpdx/common-use-cases-for-dlls-in-windows-applications-2epc</link>
      <guid>https://dev.to/nickfazzpdx/common-use-cases-for-dlls-in-windows-applications-2epc</guid>
      <description>&lt;p&gt;I understand the core principle of what a DLL (Dynamic Linking Library) is, and can even implement a very basic one to use with my program. However, I'm curious to understand the rationale of them being implemented from a software engineering perspective. Are there common use cases that could help me understand their purpose better?&lt;/p&gt;

&lt;p&gt;I notice many programs use them, yet in tutorials and even my coursework so far, DLL's never come up.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>help</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
