A common theme in dynamic programming algorithm questions on Leetcode or in job interviews, is that the underlying problem is some twist on or manipulation of the numbers of the Fibonacci sequence. The Fibonacci sequence is a series of numbers where the next number is the sum of the previous two. Normally it starts at 0,1 followed by 1,2,3,5,8,13,21 and so on. To find the nth number of a Fibonacci sequence, we can use a for loop to sum it up iteratively using something like the following:

const fib = (n) => { if (n === 1) return 0; let…

Image for post
Image for post
Pinky promise clipart 3 » Clipart Station

Have you ever tried to set the results of a fetch to a variable, but once you run your code the variable does not contain any data you hoped to get back? If you log your variable to the console or check it in a debugger, you may notice your variable’s value is an object called Promise. What exactly is this object?

Per the MDN Web Docs, a “Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.” The Promise object can have three states: pending, fulfilled, and rejected. …


Image for post
Image for post

When creating a Ruby on Rails backend, you may want to utilize an external API or set up JWT. In the case of an external API you will likely need an API key when making requests to the server. If this key is exposed to the public and someone were to find it, you could end up incurring large fees depending on the external APIs charging system. With JWT your token is encoded with a secret. If your secret lives within your code and it exposed to the public, it’s not much of a secret anymore and could be used…


Image for post
Image for post

You may have set up a Rails project using the default values, but now want to deploy it to a hosting site such as Heroku. If you follow the instructions on Heroku to push your project to their site you may receive the following error:

 !     Detected sqlite3 gem which is not supported on Heroku.
! http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
!
! Heroku push rejected, failed to compile Ruby/rails app

As the error message states, Heroku does not support the built in database management system (DBMS) for Rails, SQLite.

Why not?

As this is such a common issue for Rails developers the first time they…


Image for post
Image for post

As your webpage grows in size, it may become more difficult to grab the elements you’d like to edit. Javascript gives you multiple powerful tools to select the items you’re looking for, but it can be confusing on which one to use. In this blog I will go over a few that I’ve learned and where I’ve found them most applicable.

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Javascript DOM Element Selectors</title>
<script defer src="./src/index.js"></script>
</head>
<body>
<h1>DOM Selectors I Have Learned</h1>
<div id='learned-selectors'>
<ul>
<li class='pretty-text'>document.getElementById()</li>
<li class='pretty-text'>document.getElementsByClassName()</li>
<li class='pretty-text'>document.getElementsByTagName()</li>
<li class='pretty-text'>document.querySelector()</li>
<li class='pretty-text'>document.querySelectorAll()</li>
</ul>
</div>

Image for post
Image for post

Do you have a large excel file that you would like to get into your ruby program or rails database? There’s a gem for that! Either install the csv gem and require it, or add it to your Gemfile.

$ gem install csv

#in your .rb file

require ‘csv’

or in your Gemfile

gem ‘csv’

Once you have the necessary gem, you can now use the CSV class and its methods. The CSV class has around 125 methods, but I’ll only go over a few here.

CSV files

As the name of the gem suggests, the Excel file you want to use…

Andrew Mullan

Current Web Development student at https://flatironschool.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store