<?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: Ben Douglas</title>
    <description>The latest articles on DEV Community by Ben Douglas (@dougben).</description>
    <link>https://dev.to/dougben</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%2F176279%2F8fd13191-cca4-4eca-aa3f-d7f272c0f4e5.jpg</url>
      <title>DEV Community: Ben Douglas</title>
      <link>https://dev.to/dougben</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dougben"/>
    <language>en</language>
    <item>
      <title>Bounie Launching On Product Hunt Tomorrow</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Thu, 30 Mar 2023 14:11:01 +0000</pubDate>
      <link>https://dev.to/dougben/bounie-launching-on-product-hunt-tomorrow-4gje</link>
      <guid>https://dev.to/dougben/bounie-launching-on-product-hunt-tomorrow-4gje</guid>
      <description>&lt;p&gt;Todays a very exciting day for me as my new website &lt;a href="https://bounie.com/"&gt;Bounie&lt;/a&gt; will be launching on Product Hunt! So first of all, what is Bounie? Bounie is a news website where anyone can contribute. It all starts with a good headline. Users can then contribute related information, images, links and opinions to build out a full story. This results in articles that are dynamic feeds of engaging content instead of traditional walls of text.&lt;/p&gt;

&lt;p&gt;I give a full demo of Bounie in the video below, check it out if you want to learn more:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/-1Xv8K8nxAA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Please sign up for Bounie and let me know what you think of it! And keep an eye out for it on Product Hunt tomorrow. I greatly appreciate it!&lt;/p&gt;

&lt;p&gt;Since this is dev.to you're probably curious about the technology I used for Bounie. Here is a breakdown of the technology I used to Build it:&lt;/p&gt;

&lt;p&gt;Codebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js: I really enjoy working with this framework and the ease of deploying both the frontend and backend on Vercel&lt;/li&gt;
&lt;li&gt;NextAuth: A great user authentication library, currently I only support signing in with Google&lt;/li&gt;
&lt;li&gt;MUI: This is a new favourite of mine. I used to be all about writing pure custom scss for my websites but recently I discovered MUI and have fallen in love with it. No more class names! I strongly suggest you check it out if you are looking for a great way to style your components.&lt;/li&gt;
&lt;li&gt;Prisma: This is my goto library for querying my DB. It reminds me of working with Laravel query builder back in the day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL: The DB I decided to go with. I love working with SQL queries.&lt;/li&gt;
&lt;li&gt;Render: The platform I use to host my DB. I really like Render, its super easy to get up and running with.&lt;/li&gt;
&lt;li&gt;Vercel: Since this is a Next.js site it made sense to go with Vercel for hosting. I love their UI and they have pretty generous pricing for new websites with a moderate amount of traffic.&lt;/li&gt;
&lt;li&gt;Backblaze B2: A much cheaper S3 compatible file hosting service. Its been a breeze to work with and they even offer free downloads if you use Cloudflare DNS for serving the files.&lt;/li&gt;
&lt;li&gt;Cloudflare: The DNS choice I decided to go with to setup a Proxy for Backblaze. Cloudflare is full of rich features, although many of them I can't take advantage of since they require setting up a Proxy, which Vercel recommends not doing with there service since it can cause some big issues, especially with your cache.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That sums up the technology I used at a high level, please let me know if you have any questions!&lt;/p&gt;

&lt;p&gt;Thanks for reading this post and once again, please sign up for &lt;a href="https://bounie.com/"&gt;Bounie&lt;/a&gt; and let me know what you think. Together we can reinvent the news!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bounie.com/"&gt;bounie.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>news</category>
    </item>
    <item>
      <title>Creating a Provider to share state between components in React</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Sat, 19 Feb 2022 19:57:02 +0000</pubDate>
      <link>https://dev.to/dougben/creating-a-provider-to-share-state-between-components-in-react-30bl</link>
      <guid>https://dev.to/dougben/creating-a-provider-to-share-state-between-components-in-react-30bl</guid>
      <description>&lt;h1&gt;
  
  
  Step 1: Create a new component to define your Provider and Consumer
&lt;/h1&gt;

&lt;p&gt;In this step we are going to define a custom provider and consumer. We export two things here. &lt;/p&gt;

&lt;p&gt;First we export CustomProvider, we will use this to wrap our application at the root of our component stack. Within this component we define our state. Its important we pass both &lt;code&gt;customValue&lt;/code&gt; and &lt;code&gt;setCustomValue&lt;/code&gt; in the value attribute of our provider so we can both access the value AND set the value from within child components.&lt;/p&gt;

&lt;p&gt;Secondly, we define the function &lt;code&gt;useCustom&lt;/code&gt; which will provide a clean way to consume our state from child components.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useContext, useState } from 'react'

const CustomContext = React.createContext();

export function CustomProvider({ children }) {

    const [ customValue, setCustomValue ] = useState(false);

    return (
        &amp;lt;CustomContext.Provider
            value={{
                customValue, setCustomValue
            }}
        &amp;gt;
            { children }    
        &amp;lt;/AboutToggleStatusContext.Provider&amp;gt;
    )
}

export function useCustom() {
    return useContext(AboutToggleStatusContext)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2: Wrap the root of your component stack with our new CustomProvider component
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
import { CustomProvider } from './components/CustomContext'

ReactDOM.render(
    &amp;lt;CustomProvider&amp;gt;
        &amp;lt;App /&amp;gt;
    &amp;lt;/CustomProvider&amp;gt;,
    document.getElementById('root')
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 3: Consume our state from any child component of our provider
&lt;/h1&gt;

&lt;p&gt;Now that we are wrapping the base of our application with our &lt;code&gt;CustomProvider&lt;/code&gt; we can access the state we defined in &lt;code&gt;CustomContext&lt;/code&gt; using the function we defined &lt;code&gt;useCustom&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useCustom } from '../components/CustomContext'

export default function App() {
    const { customValue, setCustomValue } = useCustom();

    return (&amp;lt;&amp;gt;      
        Custom Value = { customValue ? 'True' : 'False' }
        &amp;lt;br/&amp;gt;
        &amp;lt;button onClick={() =&amp;gt; setCustomValue(!customValue)}&amp;gt;
            Toggle Custom Value
        &amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thats it we're done! We can now access and update the value we defined &lt;code&gt;customValue&lt;/code&gt; from within any child component of our provider and the state will be updated accross the rest of our app.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Coding the Smash Bros Ultimate Character Select Screen in HTML &amp; CSS in 2 hours</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Thu, 27 Feb 2020 20:41:52 +0000</pubDate>
      <link>https://dev.to/dougben/coding-the-smash-bros-ultimate-character-select-screen-in-html-css-in-2-hours-3a2m</link>
      <guid>https://dev.to/dougben/coding-the-smash-bros-ultimate-character-select-screen-in-html-css-in-2-hours-3a2m</guid>
      <description>&lt;p&gt;&lt;em&gt;About the series: In this video series, I try to create high quality "clones" of existing UI's from scratch using web technologies. To make it more of a challenge, I set a goal of finishing the "clone" in 1 hour!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this video, I code the Smash Bros Ultimate Character Select Screen using html, css and jekyll in 2 hour.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/WNe32jLWUJ4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Demo (Desktop only): &lt;a href="https://bendy.dev/projects/clones/smash-bros-character-select"&gt;https://bendy.dev/projects/clones/smash-bros-character-select&lt;/a&gt;&lt;br&gt;
Code: &lt;a href="https://github.com/bendygit/smash-bros-character-select"&gt;https://github.com/bendygit/smash-bros-character-select&lt;/a&gt;&lt;br&gt;
Website: &lt;a href="https://bendy.dev"&gt;https://bendy.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoy the video! I would really appreciate it if you subscribed. :)&lt;/p&gt;

&lt;p&gt;Let me know what other UI's you would like to see me recreate in this format.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>html</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Coding the Fortnite Item Shop in HTML &amp; CSS in 1 hour (x5 speed) - video</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Sun, 23 Feb 2020 18:34:09 +0000</pubDate>
      <link>https://dev.to/dougben/coding-the-fortnite-item-shop-in-html-css-in-1-hour-x5-speed-video-19o1</link>
      <guid>https://dev.to/dougben/coding-the-fortnite-item-shop-in-html-css-in-1-hour-x5-speed-video-19o1</guid>
      <description>&lt;p&gt;&lt;em&gt;About the series: In this video series, I try to create high quality "clones" of existing UI's from scratch using web technologies. To make it more of a challenge, I set a goal of finishing the "clone" in 1 hour!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this video, I code the Fortnite Item Shop using html and css in 1 hour. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/dqTENNRh9zs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Demo (Desktop only): &lt;a href="https://bendy.dev/projects/clones/fortnite-item-shop"&gt;https://bendy.dev/projects/clones/fortnite-item-shop&lt;/a&gt;&lt;br&gt;
Code: &lt;a href="https://github.com/bendygit/fortnite-item-shop"&gt;https://github.com/bendygit/fortnite-item-shop&lt;/a&gt;&lt;br&gt;
Website: &lt;a href="https://bendy.dev"&gt;https://bendy.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoy the video! I would really appreciate it if you subscribed. :)&lt;/p&gt;

&lt;p&gt;Let me know what other UI's you would like to see me recreate in this format.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>html</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Coding the Google Search homepage in HTML &amp; CSS in 40 minutes (x5 speed) - video</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Sun, 23 Feb 2020 18:11:57 +0000</pubDate>
      <link>https://dev.to/dougben/coding-the-google-search-homepage-in-html-css-in-40-minutes-x5-speed-video-1oa1</link>
      <guid>https://dev.to/dougben/coding-the-google-search-homepage-in-html-css-in-40-minutes-x5-speed-video-1oa1</guid>
      <description>&lt;p&gt;&lt;em&gt;About the series: In this video series, I try to create high quality "clones" of existing UI's from scratch using web technologies. To make it more of a challenge, I set a goal of finishing the "clone" in 1 hour!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Back in October I started a series on youtube where I make a clone of a UI in a short period of time. The main reason I created this video series was because I thought it would be a good way to showcase the magic of coding to non-programmers, where you can build something out of nothing.&lt;/p&gt;

&lt;p&gt;In this video, I code the google search homepage in 40 minutes.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/pwYc7vDDikU"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Demo (Desktop only): &lt;a href="https://bendy.dev/projects/clones/google-search"&gt;https://bendy.dev/projects/clones/google-search&lt;/a&gt;&lt;br&gt;
Code: &lt;a href="https://github.com/bendygit/google-search"&gt;https://github.com/bendygit/google-search&lt;/a&gt;&lt;br&gt;
Website: &lt;a href="https://bendy.dev"&gt;https://bendy.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoy the video! I would really appreciate it if you subscribed. :)&lt;/p&gt;

&lt;p&gt;Let me know what other UI's you would like to see me recreate in this format.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>html</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>My coding playlist</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Sun, 23 Feb 2020 13:28:37 +0000</pubDate>
      <link>https://dev.to/dougben/my-coding-playlist-11p1</link>
      <guid>https://dev.to/dougben/my-coding-playlist-11p1</guid>
      <description>&lt;h1&gt;
  
  
  The Playlist
&lt;/h1&gt;

&lt;p&gt;&lt;iframe src="https://open.spotify.com/embed/playlist/4HAXjLcuA4VT13MT9kSCQ3" width="100%" height="380px"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;I've been making a coding playlist for the last couple of months and I thought it may be of interest to other devs out there.&lt;/p&gt;

&lt;p&gt;The playlist is mostly electronic with lyrics, so if that distracts you then this is probs not the playlist for you. I find this genre of music helps me code for much longer periods of time.&lt;/p&gt;

&lt;p&gt;I update the playlist pretty frequently so give it a follow if you like it!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://open.spotify.com/playlist/4HAXjLcuA4VT13MT9kSCQ3?si=RTB_J6VdRo61WkGtTxlg2A"&gt;https://open.spotify.com/playlist/4HAXjLcuA4VT13MT9kSCQ3?si=RTB_J6VdRo61WkGtTxlg2A&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>codenewbie</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Creating a Simple Multi Click Button in Javascript</title>
      <dc:creator>Ben Douglas</dc:creator>
      <pubDate>Sat, 22 Feb 2020 14:52:17 +0000</pubDate>
      <link>https://dev.to/dougben/creating-a-simple-multi-click-button-in-javascript-3m42</link>
      <guid>https://dev.to/dougben/creating-a-simple-multi-click-button-in-javascript-3m42</guid>
      <description>&lt;h1&gt;
  
  
  What we are making
&lt;/h1&gt;

&lt;h5&gt;
  
  
  Note: Hey! This is my first post on dev.to :) I would appreciate a follow if you like the post and want more!
&lt;/h5&gt;

&lt;p&gt;Recently I was thinking about how common the action of tapping something a certain number of times on mobile apps triggers an action (ex. double click), but I have never seen that method being used on the web.&lt;/p&gt;

&lt;p&gt;So I thought it would be interesting to implement a multi click button for fun in javascript.&lt;/p&gt;

&lt;h1&gt;
  
  
  Demo
&lt;/h1&gt;


&lt;div class="glitch-embed-wrap"&gt;
  &lt;iframe src="https://glitch.com/embed/#!/embed/multi-click?previewSize=100&amp;amp;path=index.html" alt="multi-click on glitch"&gt;&lt;/iframe&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://glitch.com/edit/#!/multi-click?path=public/client.js:1:0"&gt;https://glitch.com/edit/#!/multi-click?path=public/client.js:1:0&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  The process
&lt;/h1&gt;

&lt;p&gt;Essentially instead of having an action trigger immediately, you wait a small amount of time, and if the button is pressed again before the timer runs out the, you count another click and restart the timer.&lt;/p&gt;

&lt;h1&gt;
  
  
  The JavaScript
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// total number of clicks in a sequence of button presses
var clicks = 0;

// speed in ms of how long the space between clicks can be
// the lower the number, the more responsive clicks will feel
var wait = 300;

const trigger = document.getElementById("trigger");
const response = document.getElementById("response");

var timer = null;

trigger.onclick = function() {
  response.innerHTML = "waiting...";
  clicks++;

  clearTimeout(timer);

  timer = setTimeout(function() {
    response.innerHTML = "Clicks: " + clicks;
    clicks = 0;
  }, wait);
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;The real challenge of developing a multi click button is finding the perfect timeout between clicks. If the delay is too long, the button will feel unresponsive. If the delay is too short, then it may be too fast for the user and cause them to trigger the wrong action.&lt;/p&gt;

&lt;p&gt;The default response time on windows is 500ms, but I found 300ms was more than enough time between clicks.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed my first tutorial! I would appreciate a follow if you like the post and want more.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
