<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by JoeyFaris on Medium]]></title>
        <description><![CDATA[Stories by JoeyFaris on Medium]]></description>
        <link>https://medium.com/@joeyfaris1?source=rss-3e3880e5a434------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by JoeyFaris on Medium</title>
            <link>https://medium.com/@joeyfaris1?source=rss-3e3880e5a434------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:52:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joeyfaris1/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding the basics of Big O complexities]]></title>
            <link>https://medium.com/@joeyfaris1/understanding-the-basics-of-big-o-complexities-18d3e249ddb1?source=rss-3e3880e5a434------2</link>
            <guid isPermaLink="false">https://medium.com/p/18d3e249ddb1</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[big-o-notation]]></category>
            <category><![CDATA[time-complexity]]></category>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[space-complexity]]></category>
            <dc:creator><![CDATA[JoeyFaris]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 03:10:54 GMT</pubDate>
            <atom:updated>2022-09-07T20:28:22.502Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether you involved in front end or back end development, full-stack, cyber security engineer, data analyst or any other area where you are writing code to make a product or service work efficiently, you will likely need to understand the concepts of algorithms, and time and space complexity.</p><p>Let’s say you’re given a problem and you draw up some code in order to solve it. There are multiple ways to go about solving each problem, but what is the most efficient?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*tmoDmd2ncpWf-9N0PeL-_Q.jpeg" /></figure><p>Bring in the Big O notation. But, what is the Big O notation? Simply put, the Big O notation is a measurement system that is used to determine the time complexity of a given algorithm. In more basic terms, it figures out how quickly an algorithm (or any function for that matter) can complete the task it’s trying to accomplish.</p><p>Throughout this post, I will be going over three different Big O complexities and try to break them down as easy as possible. The first will be O(1), which is a constant, and will be the most efficient mathematical algorithm (“O” meaning Order of magnitude). The second O(N), is a linear algorithm. And finally, I’ll go over O(log n), which is a logarithmic.</p><h4>O(1): The constant</h4><p>O(1) is the most simple Big O complexity that programmers would ideally strive for, though it’s likely not possible for complex problems. Simply put, this algorithm will take the same number of steps no matter how much data is available, <strong>one</strong>. It won’t need to iterate over each and every data point to check if something is true or false, it won’t need to add all integers together in a given array to find the sum, it just needs to do one thing and the task is complete.</p><p>If you ever tried to learn a new programming language, the first thing you were likely taught was something along the lines of <em>print “Hello World!” . </em>Believe it or not, this is an example of an O(1) complexity. This is because it does one thing and one thing only, prints the phrase “Hello World!” and it’s finished! Pretty easy, right?</p><h4>O(n): Linear</h4><p>This linear equation will vary depending on the given number of input variables. Let’s say for example, your given an array of 5 separate integers and you’re told to find the sum of all integers within the array. For the sake of argument, you’d likely write some code along these lines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_UtdB17xWW_iaBhctz0hA.png" /></figure><p>In order to complete this task, the function needs to iterate through each integer, adding it to the sum of the previous two numbers (0 + 1 = 1; 1 + 5 =6; and 6 + 10 = 16). Since there are 3 integers in the array and the function is iterating each integer, the task will be complete in 3 steps! So, if there were 1000 items in the array and we used this exact function, it would take 1,000 steps to complete the task, giving this equation a linear function. To summarize, the time required to complete the function is dependent on the amount of input variables in the equation, or “n” times.</p><h4>O(log n): Algorithmic complexity</h4><p>In an ideal world, this type of algorithm is what those in programming aim to reach. It’s scalable, and is better than O(n), in that the steps to take to complete the task actually decreases as input size increases. When dealing with increasingly large amounts of data, it’s ideal to find a method that can keep up with dealing with this data, or even outpace it. This is what O(log n) does.</p><p>A good and common example of algorithmic complexity is this example: Let’s say we have a data set of 100 numbers and we are told to find a single, random number. The most ideal computational method is to perform a binary search that looks through half of the numbers first. Once the first half is sorted- if the number is found, great! If not, we would discard that half and move to the second half. From there we would cut the second half, in half again, and search through this new data set. We would do this until that number is found.</p><p>This is called binary search and is ideal because it makes the algorithm adaptable on a very large scale. In mathematical terms, for every item in the data set, the time to complete is decreased in order of magnitude inversely proportionate to that of “N”. Here is how it would look on a graph:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*4MN1PhTNpluNK62Fj4OREg.png" /></figure><p>And there you have it! Some basic fundamentals to understand Big O Complexities. There are tons more mathematical equations that determine different algorithms and how their run times compare to different input sizes. For reference, here is a very well known <a href="https://www.bigocheatsheet.com/">Big O cheat sheet</a> and how their relationships with common data structures and sorting algorithms.</p><p>I hope that gave you a more concrete understanding of the Big O complexities. Understanding <em>why</em> to write efficient algorithms is just as important to knowing <em>how</em>! Big O complexities are also common interview questions (Obviously, they can be a bit more complex), so it’s good to have these concepts engraved in the back of your mind.</p><p>Sources:</p><p><a href="https://en.wikipedia.org/wiki/Big_O_notation">Big O Wikipedia</a></p><ul><li><a href="https://www.bigocheatsheet.com/">Know Thy Complexities!</a></li><li><a href="https://www.freecodecamp.org/news/big-o-notation-why-it-matters-and-why-it-doesnt-1674cfa8a23c/">What is Big O Notation Explained: Space and Time Complexity</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18d3e249ddb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add bcrypt in Rails to ensure authorization and authentication]]></title>
            <link>https://medium.com/@joeyfaris1/add-bcrypt-in-rails-to-ensure-authorization-and-authentication-7831e9cd7162?source=rss-3e3880e5a434------2</link>
            <guid isPermaLink="false">https://medium.com/p/7831e9cd7162</guid>
            <category><![CDATA[activerecord]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[bcrypt]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[JoeyFaris]]></dc:creator>
            <pubDate>Mon, 22 Aug 2022 03:20:29 GMT</pubDate>
            <atom:updated>2022-08-22T03:42:18.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*IMaI5Pr0qzzvW2ziCI4Drw.jpeg" /></figure><p>Almost every website and app that are developed in today’s age has some sort of user login and sign up feature. Facebook, Instagram, Spotify, LinkedIn, The New York Times, Yahoo, Slack, and even the website your reading this on has tracks profiles in order to authenticate the user and ensure the user has authorization use different aspects of their site. The benefit for these companies is that they get access to all information about the user. They’re able to check monthly payments, track their data usage across their site, and then cater advertisements or other economic incentives towards that user to drive up profits. However, storing user information such as names, emails, addresses, even credit card information can be risky. For instance, check out some of the largest data breaches within the last 20 years <a href="https://www.upguard.com/blog/biggest-data-breaches">here</a>.</p><p>As a smaller engineer, you probably won’t be making a site that hundreds of millions of users will be using (but maybe you might). However, it’s important to know how to keep user information safe.</p><p>If you are going to be creating a Rails application, a useful tool to know is the Ruby gem, <a href="https://github.com/bcrypt-ruby/bcrypt-ruby">bcrypt</a>. To ensure the bcrypt gem is installed, run the following:</p><pre>gem install bcrypt</pre><p>And make sure the gem is added in your Gemfile:</p><pre>gem &quot;bcrypt&quot;, &quot;~&gt; 3.1.7&quot;</pre><p>Then, as we are creating our models and tables, we must include the has_secure_password method in the User model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*u61qjzhmS53QFHL1pVxBxg.png" /></figure><p>Rails uses the bcrypt gem to hash and salt all passwords on the User model (Hash and salt are terms used that define the details of how bcrypt works. If you want to learn more on that, <a href="https://www.theguardian.com/technology/2016/dec/15/passwords-hacking-hashing-salting-sha-2#:~:text=Passwords%20are%20often%20described%20as,in%20front%20of%20each%20password.">click here</a>). This has_secure_password has two instance methods on our user models, password and password_confirmation. In order to activate the has_secure_password method, we must include the column password_digest as a string within our table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INzwMSUg44fdxxUGDooECw.png" /></figure><p>bcrypt handles validating the password and password_confirmation by converting it into the password_digest that is saved within our backend.</p><p>Before we can have create our controllers to handle all of the user input from our forms, we must make it clear what each must do in order to handle all of the information. We’ll start simple with easy login and signup pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*tqk3xv4fPb5fJTpEBP-QyA.png" /></figure><p>So, let’s start with the sign up page. Once a user goes to sign up on your website, they’ll be taken to <a href="http://www.your-domain.com/signup,">www.your-domain.com/signup,</a> we need to let our back end know how to handle the data input. The code snippet below will handle the actions for creating a new user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yBhHFCuzGOR-uO9aSeKESQ.png" /></figure><p>Notice that in our user_params permission, we included password and password_confirmation, instead of password_digest. This is important to remember because of our bcrypt gem that we installed. Behind the scenes, our bcrypt gem is doing all the work to ensure the sign up is authentic and our user is safe.</p><p>Next, let’s take a look at the log in page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WTwRTF4HyBNXtdUPY7EQiA.png" /></figure><p>This would be taking place in the SessionsController instead of the UserController. This is because we have already created the user profile, we are just checking the information to ensure this is an authorized user.</p><p>When dealing with user data, it’s important to have a good understanding of how to keep their information safe for security purposes. If you’re specifically using Ruby on Rails to handle your back end, the bcrypt gem is a useful tool to keep that information safe.</p><p>Sources:</p><ul><li><a href="https://hackernoon.com/authentication-and-authorization-with-bcrypt-in-rails-mw1g3u3l">Authentication and Authorization with bcrypt In Rails | HackerNoon</a></li><li><a href="https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html">ActiveModel::SecurePassword::ClassMethods</a></li><li><a href="https://www.npmjs.com/package/bcrypt">bcrypt</a></li><li><a href="https://github.com/bcrypt-ruby/bcrypt-ruby">GitHub - bcrypt-ruby/bcrypt-ruby: bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users&#39; passwords.</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7831e9cd7162" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Active Record Migrations]]></title>
            <link>https://medium.com/@joeyfaris1/active-record-migrations-1ffe85f65763?source=rss-3e3880e5a434------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ffe85f65763</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[activerecord]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[JoeyFaris]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 05:32:17 GMT</pubDate>
            <atom:updated>2022-08-01T05:32:17.169Z</atom:updated>
            <content:encoded><![CDATA[<p>Active record is a feature used within Ruby that utilizes a DSL (Domain Specific Language) in order for the user to be able to communicate between their application and the application’s database. Migrations are a component within ActiveRecord provides easy methods to create, access, update, merge, or delete certain aspects of those databases. Below we will discuss a number of active record migrations and how they can help make your life easier as a programmer.</p><blockquote><strong>Creating Migrations:</strong></blockquote><p>Let’s say you are building out a back end application through ruby and you need to store data in your database through SQL. Instead of manually typing every SQL command to build your database, Active Record gives you the shortcut so you don’t have to.</p><p>Think of each migration as a new version or segment of your database. To create a migration, type the following code in your console:</p><pre>rails generate migration CreateMovies</pre><p>The migration will then generate its own db file with the following code automatically populated. The schemata of the migration may look as follows, once the table is created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCfSL_QKYUt-3iPezvOtKA.png" /></figure><p>Once migrated, a new table called “movies” will be created. Inside the table will have the columns with the titles “title”, “genre”, and “release date”, with the column types being “string”, “string”, and “integer”, respectively. You can double check that this worked by checking the applications file <strong>db/schema.rb.</strong></p><blockquote><strong>Editing migrations:</strong></blockquote><p>Another cool aspect of ActiveRecord is that these migration tables can be edited with simple, easy to understand syntax. If you want to add or remove a new column to a pre-existing table, you can generate a new class with a migration name of “AddColumnToTable” or “RemoveColumnFromTable” followed by a list of the column names and types. The migration will then add the appropriate columns to the respective table. For example the following code:</p><pre>rails generate migration AddLengthToMovies length:string</pre><p>will generate:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kl9vh65ez1x_ClDm4OO_4Q.png" /></figure><p>You can do the same with removing columns, as shown:</p><pre>rails generate migration RemoveLengthFromMovies length:string</pre><p>will produce:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tzhkhwkzinnwllyospA7WA.png" /></figure><blockquote>To see more on how edits can be made through ActiveRecord, <a href="https://guides.rubyonrails.org/active_record_migrations.html#using-the-change-method">click here</a></blockquote><p><strong>Rolling Back:</strong></p><p>Another very common task when handling migrations is to use the rollback method. Let’s say you were working on a new migration and you made a mistake that needed to be changed. The rollback method will undo the most recent migration.</p><pre>rails db:rollback</pre><p>Let’s say you wanted to restart from the last 3 migrations. You can add the STEP parameter to the rollback feature to let the application know how many migrations you want to go back to:</p><pre>rails db:rollback STEP=3</pre><p>And there you have it. A basic guideline to help get you started using ActiveRecord migrations through Ruby on Rails. There are plenty of other tasks that you can take advantage of that I couldn’t get into details on this blog. If you have any further interest looking into those tasks, take a look at a few of my sources below.</p><p><a href="https://web-crunch.com/posts/understanding-active-record-migrations">Understanding Ruby on Rails Active Record Migrations</a></p><p><a href="https://guides.rubyonrails.org/active_record_migrations.html">Active Record Migrations Overview</a></p><p><a href="https://stackify.com/rails-migration-a-complete-guide/">Rails Migration A Complete Guide</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ffe85f65763" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New to web development? Turn to twitter.]]></title>
            <link>https://medium.com/@joeyfaris1/new-to-web-development-turn-to-twitter-11991cfed8bd?source=rss-3e3880e5a434------2</link>
            <guid isPermaLink="false">https://medium.com/p/11991cfed8bd</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[back-end-development]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[JoeyFaris]]></dc:creator>
            <pubDate>Thu, 07 Jul 2022 04:14:43 GMT</pubDate>
            <atom:updated>2022-07-11T04:00:48.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Becoming a software engineer can be a very difficult task that takes years of practice and consistency before becoming a leveraged engineer within the industry. Luckily, Twitter is full of mentors, teachers, and long time engineers that can help provide guidance &amp; resources to help get things started or keep your skill set up to date. Whether you’re a seasoned pro or just getting your feet wet, here are some of the best twitter accounts to follow to keep your skills sharp:</p><h3>Swapna Kumar Panda</h3><p><a href="http://twitter.com/@swapnakpanda"><strong><em>@swapnakpanda</em></strong></a><strong><em> </em></strong>— | Concepts, Tips, Cheat Sheets, Questions | DSA, JS, React, SQL/NoSQL, WebDev |</p><p>Swapna is a tech educator from India who tweets about programming tutorials, practice questions, infographics &amp; cheat sheets about specific coding languages. Below is an example of his infographic for the array methods in Javascript:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1BI26vOzBAXAMIQYJvlqw.jpeg" /></figure><h3><strong>Adarsh Gupta</strong></h3><p><strong><em>@</em></strong><a href="https://twitter.com/adarsh____gupta"><strong><em>adarsh____gupta</em></strong></a><strong><em> </em></strong>—Learn Web Development like it’s 2050 | CSE UnderGraduate |Javascript is my armor Reactjs is my sword</p><p>Adarsh is a web developer from India who tweets threads about general programming concepts. He also has a weekly newsletter to help keep your mind up to date about unique Javascript features:</p><h3>Adarsh Gupta ⚡ on Twitter: &quot;✨ 50 Project Ideas for Web Developers✨ pic.twitter.com/aL6GbekdlS / Twitter&quot;</h3><p>✨ 50 Project Ideas for Web Developers✨ pic.twitter.com/aL6GbekdlS</p><h3>RapidAPI</h3><p><strong><em>@</em></strong><a href="http://twitter.com/Rapid_API"><strong><em>Rapid_API</em></strong></a> —RapidAPI is the world’s largest API Hub, where over three million developers find, connect, build, and sell tens of thousands of APIs.</p><p>This account is the main twitter domain for the website RapidAPI. The site provides thousands of API’s for computer programmers to interact with data and their projects. Their twitter account tweets about information to help better understand the complexity of API’s:</p><h3>RapidAPI on Twitter: &quot;Five items you should have in your API security checklist.Thread 🧵 / Twitter&quot;</h3><p>Five items you should have in your API security checklist.Thread 🧵</p><h3>Nanou Symeon</h3><p><a href="http://twitter.com/NanouuSymeon"><strong><em>@NanouuSymeon</em></strong></a><strong><em> — </em></strong>Digital &amp; CSS Designer || Coding Tutor + Course Creator || Tech Geek || Social Media Addict || Youtuber to be</p><p>Nanou is a web designer that provides tips &amp; tricks about basics CSS structures and frameworks. Every few days, she’ll provide some CSS code with the design to help beginning coders get a better understanding of how CSS can be implemented:</p><h3>* nanou * on Twitter: &quot;Easy, Static, One-page Portfolio? Using only 45 lines of CSS! 👇🏻Code: https://t.co/HCVEpB8J7L#100DaysOfCode #womenwhocode #womenintech pic.twitter.com/dP7sgaD5i4 / Twitter&quot;</h3><p>Easy, Static, One-page Portfolio? Using only 45 lines of CSS! 👇🏻Code: https://t.co/HCVEpB8J7L#100DaysOfCode #womenwhocode #womenintech pic.twitter.com/dP7sgaD5i4</p><h3><strong>Sumit</strong></h3><p><a href="https://twitter.com/sumitsaurabh927"><strong><em>@sumitsaurabh927</em></strong></a><strong><em> — </em></strong>Web Development + Blogging = Life-changing opportunities | Daily threads on web development | Full Stack Software engineer at 100Devs</p><p>Sumit is a small account that primarily focuses on Javascript and React threads. Instead of providing code to help beginners understand the technical side of things, Sumit provides threads that details the functionality of what’s going on behind the code. Check out his thread on promises in Javascript:</p><h3>Sumit | Javascript 🤝 React on Twitter: &quot;📌 Understand Promises in 9 simple tweets pic.twitter.com/VCZvN2JpPb / Twitter&quot;</h3><p>📌 Understand Promises in 9 simple tweets pic.twitter.com/VCZvN2JpPb</p><p>Written by Joey Faris | <a href="https://www.linkedin.com/in/joey-faris-8aa360157/">See his LinkedIn profile</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11991cfed8bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>