React Native is a mobile development framework written in JavaScript. It uses React.js which is a JavaScript library for building user interfaces. It also has its own special components that know how to communicate with the native device’s platform so you can build a user interface. Mobile devices don’t use HTML tags so React Native gives us those components that can render our user interface. It gives us access to the device’s API like the device’s camera, and more.
It gives us everything we need to create a real mobile app that we could have in the IOS and Andriod…
This week I was working on another algorithm problem from my Colt Steele Udemy course. This is another frequency counter type problem but this time I’m working to see if two strings are anagrams of each other.
Given two strings, write a function to determine if the second string is an anagram of the first. An anagram is a word, phrase, or name formed by rearranging the letters of another, such as “cinema”, formed from “iceman.”
Inputs: string1=“ ” , string2=“ ”
Output: true
Inputs: string1=“aaz” , string2=“zza”
Output: false
Inputs: string1=“anagram” , string2=“nagaram”
Output: true
Inputs: string1=“awesome” , string2=“awesom”…
This week I was worked on an algorithm problem I came across on one of my Udemy courses by Colt Steele. I worked on how to problem-solve common algorithm question types. In particular how to turn an algorithm that would’ve been O(n²) if solved naively to an O(n) notation by using javascript objects instead of having a loop inside of a loop.
Write a function called same, which accepts two arrays. The function should return true if every value in the array has its corresponding values squared in the second array. The frequency of values must be the same.
Examples…
I’ve decided that I will start reviewing some of the algorithm problems I come across while practicing on LeetCode.
Given an array
nums
. We define a running sum of an array asrunningSum[i] = sum(nums[0]…nums[i])
.Return the running sum of
nums
.
Input: nums = [1,2,3,4]
Output: [1,3,6,10]
Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4].
1 <= nums.length <= 1000
-10^6 <= nums[i] <= 10^6
var runningSum = function(nums){};
The first thing I did before coding anything was to make sure I understood what the problem was. The examples provided did a pretty good job at…
When I began my journey in learning algorithms to become a better coder, this was the first big lesson — “Big O”. The name was daunting enough but after watching several videos and seeing in action how important Big O is, I wanted to explain it in one blog.
So Big O is all about “time complexity” (will be omitting space complexity in this blog). It gives us a numeric value (O notation) of how well our code performs, especially in a worst-case scenario of our input being a very large number or an array.
The problem with measuring how…
Have you ever wanted to send out emails from and app you’ve created?
Well I’m here to show you how! With Rails ActionMailers you can start sending emails to users, in less than 15 minutes! Let me show you how.
We’re going to create an app where a user gets an email from us when they sign up for an account with us.
First thing you want to do is run the rails generator to create your Mailer like so: rails g mailer <name_of_mailer>.
rails g mailer new_user
After this code is ran, two files are created:
The…
The transition from Ruby on Rails to JavaScript was not as bad as I thought it would be. In fact, they share a lot of similarities. For one, functions was very similar to Ruby’s methods. Though there are some core differences that I’d like to discuss about JavaScript’s functions.
In Ruby we can call a method by writing its name. If we do so in ruby, we are only referencing the function’s definition. For example:
RESTful routing is a way to make navigating our web applications easier. It gives us a simple and consistent design pattern for implementing CRUD actions in our routes.
Rails has a simple way of implementing this. When we create our new rails project folder by running rails new. It comes with many folders that seem a bit overwhelming at first. Luckily, we only need to focus on a few folders to implement our RESTful routes: app, and config.
The example I’m going to be using is a web application for Creating, Reading, Updating, and Deleting an article. A great website…
After learning how to create methods, enumerate through hashes, arrays, arrays of hashes and hashes of arrays *deep breath*…
We then began learning how to create a class. A class is a Ruby object that is used as a blueprint to create more objects that are instances of that class. A class holds attributes about itself that we’d like to know. For example, a Pet class would hold attributes about its name, breed or any other information that we’d like our Pet objects to have. …