Tag: javascript
Monitor Device Battery Status Using Ionic Framework
So you’re making a mobile app using Ionic Framework and you care about the experience your users receive? Maybe you want to control the functionality of certain features based on how much battery the users device has left.
An example of this is, maybe you have your application pulling remote data while the application is open. Maybe you’ve decided that if your users battery is less than 30% you want the user to have to pull-to-refresh in order to preserve battery life.
This kind of battery monitoring can be performed through the cordova-plugin-battery-status plugin by Apache Cordova.
Read MoreUse RegEx To Analyze Credit Card Numbers In JavaScript
RegEx is a powerful beast. Previously I wrote how to test password strength using JavaScript and regular expressions. This time we’ll take a look at how to check credit card providers based on the credit card number entered. No, this won’t test if a credit card number is legitimate, but it will test if it was entered correctly.
Read MoreHighlight Text In A String Using JavaScript And AngularJS
Have you ever wanted to highlight text in a string on a web page using AngularJS? If your answer was no, don’t disregard, because you may one day need to. The good thing is this is not very hard to accomplish.
There are many ways to do this using JavaScript, but we’re only going to examine one of those methods.
Using AngularJS and a few regular expressions (RegEx) with JavaScript, you can find text in a string and then apply your own customizations.
Read MoreGet Remote HTML Data And Parse It In Express For Node.js
Have you ever wanted to fetch remote HTML data in a similar fashion to cURL or Wget using some backend web service and parse it? If you said no, don’t worry, I said the exact thing until I was challenged to do so. For the challenge, I chose to use Express as my framework and a few libraries to assist in the process of fetching and parsing.
I chose to use the HTTP and HTTPS libraries for fetching the data and the htmlparser2 for parsing the HTML data. These are of course only a few of many alternatives to choose from for such a task.
Read MoreUse RegEx To Test Password Strength In JavaScript
Recently one of my Twitter followers asked me how they might validate password strength using regular expressions (RegEx) in their code.
Regular expressions via Wikipedia:
A sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or string matching.
RegEx is nice because you can accomplish a whole lot with very little. In this case we are going to check various aspects of a string and see if it meets our requirements, being a strong or medium strength password.
Read MoreDetermine If A Number Is Prime Using JavaScript
Continuing on the topic of interview questions for programming and software engineering type positions, I thought I’d brush up on a popular one.
Although I have never personally been asked about this, other people have told me that they’ve been asked to determine if a number is prime or to print out all prime numbers up to a certain number.
Read MoreCreate A Complex Calculator App Using Ionic Framework
If you’ve been keeping up, I previously wrote two tutorials on the topic of evaluating mathematical expressions. The first tutorial was on the topic of converting an Infix expression into a Postfix expression also known as Reverse Polish Notation using the Shunting Yard algorithm. The second tutorial was on the topic of solving the Postfix expression.
Using the hybrid application framework, Ionic Framework, we’re going to create a calculator application for solving these complex expressions. Think of it as a mobile front end for the nice algorithms we made.
Read More