Bennett Notes

    Recent Posts 🧑🏾‍💻

  • How to build a Chrome Extension Mar 28 2018
    Chrome extensions are really cool. They allow the user to extend the capabilities of their browser and can incorporate really well into existing apps. So let’s take a look at how to build a Chrome Extension in less than 10 minutes. Chrome Extensions are written in Javascript, so I recommend that you have a basic understanding of Javascript before proceeding with this tutorial. What we’re building We are going to build a simple chrome extension that will allow you to search google for any text that you highlight on a page.

  • Blockchain and Decentralization will NOT fix the Internet Mar 26 2018
    Stop saying that blockchain and decentralizing everything will fix the Internet. There has been a lot of news around Cambridge Analytica abusing Facebook profile data, and Facebook for mining user data without explicit permission. Yes, I agree that these are very bad things that need to be addressed. And I also agree that while Facebook is at the front-lines of this digital privacy war, we could also blame many other companies like Google, Twitter, Amazon, etc for similar practices.

  • React Native StackNavigator Tutorial Mar 26 2018
    I have spent hours trying to figure out how to actually use the React Native Stacknavigator to navigate between screens. All the tutorials and guides seem to be missing important information, and the official React Native documentation is truly lacking in substance. So I want to save you some headache and give you a quick and easy setup to using the React Native StackNavigator. You need to Eject If you created your react-native project using the command:

  • Google Poly API Javascript and NodeJS Mar 26 2018
    Google has been working on an interesting project called Poly. With Poly, you have access to hundreds of 3D objects that can be used to build VR games or with AR content. The interesting about Poly is that all of the graphics are available on demand. Think of it like Google Fonts just for 3D objects. So let’s take a look at how you can get started with Google Poly API Javascript and NodeJS bundle.

  • React Context API Mar 22 2018
    I’m sure you have probably heard of the fancy new React Context API. It’s a new way for you to manage application state. If you are building a large react application, you have probably encountered a problem where you needed to access and share data across multiple components. For example, we might have information on the currently authenticated user that multiple components need information on. To solve this issue, you might use a library like Redux or Mobx.

  • React Native Android App Receive Data from Share Intent Mar 07 2018
    This whole problem started when I was working with an app in React Native. I wanted the app to be able to open when it received data from another app through the “share with” intent. For example, if I share an URL through the YouTube app, I wanted my app to be recognized as one of the apps that could handle the URL and open it. I am going to spoil the fun and tell you that there’s no easy way to do it straight through javascript with React Native.

  • Typescript Getter and Setter Mar 07 2018
    This is something that you probably don’t ever think about, but getters and setters are implicit on every javascript object. For example, if we take the following: person = {}; person.name = 'Dave' //uses the implicit setter on the object console.log(person.name) //uses the implicit getter The above code is something that you have probably have seen very often in javascript. However, this doesn’t give you much control over how properties are accessed or defined.

  • Angular 4 input only numbers Directive Mar 07 2018
    I was working on a project in Angular 4 and needed to implement input fields that only accept numerical values. My first thought was to simply add the HTML5 type=”number” to the input. Unfortunately, this isn’t supported in Internet Explorer 10 and some of the clients would most likely be using Internet Explorer 10. My only other option was to implement a directive. Thanks to this StackOverflow answer, I was able to modify it to my needs.

  • Implementing Token Interceptor and Retry in Angular 4 Feb 23 2018
    If you are building a web application using Angular 4 or Angular 5 there’s a good chance that you might be working with JWT tokens. Luckily, implementing token interceptor and retry in Angular 4 and beyond is very easy thanks to the new HTTP Interceptors. Using this, we can add an authorization header to every outbound request while also implementing a retry mechanism for requests that fail due to an expired token.

  • Implementing Token Interceptor and Retry in Angular 4 Feb 23 2018
    If you are building a web application using Angular 4 or Angular 5 there’s a good chance that you might be working with JWT tokens. Luckily, implementing token interceptor and retry in Angular 4 and beyond is very easy thanks to the new HTTP Interceptors. Using this, we can add an authorization header to every outbound request while also implementing a retry mechanism for requests that fail due to an expired token.

  • Simple CSS Hack Can Steal Internet Passwords Feb 21 2018
    A user on GitHub just posted an alarming exploit shows how a simple CSS hack can steal internet passwords. It’s kinda funny how you wouldn’t really think of CSS when it comes to vulnerabilities and hacking. Since CSS is only used to style a webpage, its threat level is generally considered to be relatively low. However, CSS does provide developers with very advanced selectors. In this case, if you wanted to select an input with the value of A in it and turn it red, then CSS allows you to do that.

  • How to build a forum Feb 20 2018
    Practically every online community has a forum. It makes sense though because forums are a great way to facilitate online discussion. Now let’s say that you wanted to build your own online forum. Well, building a very basic forum wouldn’t be too complicated. Just script together some PHP with an MYSQL database and you will be all set. Unfortunately, this would likely leave you vulnerable to many potential security holes and a terrible user experience.

  • Run Windows Applications (EXE Files) on Android Jan 29 2018
    If I had a dollar for the number of times someone asked how to run Windows Exe Files on Android, I would be richer than your top Bitcoin miners. Most of the time, my response would have simply been that it’s not possible, end of story. Well, that sort of changed this week. If you are a Linux user, you have probably heard of Wine. The tl;dr is that Wine allows you to run Windows apps in Linux (it’s a Windows compatibility layer).

  • Angular 4 Forms Jan 13 2018
    One of my favorite features in Angular are forms. Using Angular 4 forms or Angular 5 forms are very helpful because they provide for quick validation and object mapping. Here’s how you can create a basic angular 4 form (also works with angular 2, and angular 5). HTML You will also notice that I am using Bootstrap for some styling, that is completely optional. Let’s look at the form HTML:

  • Android Recyclerview for Installed Apps with Checkbox Jan 13 2018
    One of the most common reasons that you would want to use the android recyclerview is if you want to show a list of some sort. In this example, let’s take a look at how you can use the android recyclerview to show a list of installed apps on your device. Within each item, we will also include a checkbox. Here’s what it will look like: Layout Let’s first take care of creating the layout files.