https://www.davidangulo.xyz/David Angulo - Software EngineerMy name is David Angulo, a software engineer. 2023-06-07T22:15:17+08:00 David Angulo https://www.davidangulo.xyz/ Jekyll © 2023 David Angulo /assets/img/favicons/favicon.ico /assets/img/favicons/favicon-96x96.png Doing CS50's Lab 6: World Cup problem in Ruby2023-05-01T00:00:00+08:00 2023-05-01T13:56:18+08:00 https://www.davidangulo.xyz/posts/doing-cs50s-lab-6-world-cup-problem-in-ruby/ David Angulo Yesterday, I experienced a power outage where I’m left with just a laptop at 50% battery with Ruby interpreter and a mobile phone with limited internet access. With nothing else to do I tried to do CS50’s Lab 6: World Cup problem, since I have no Python experience at this time, I instead tried to do it in Ruby. I connected my laptop to my mobile data just to load the problem’s page and to dow... Password protect your Sinatra app with basic HTTP authentication2023-02-17T00:00:00+08:00 2023-02-17T08:24:04+08:00 https://www.davidangulo.xyz/posts/password-protect-your-sinatra-app-with-basic-http-authentication/ David Angulo Have you ever visited a site that asks you to provide a username and password on a form that resembles a JavaScript alert? That is an example of a basic HTTP auth. Sometimes we don’t need to implement an app-level sophisticated authentication to password protect our Sinatra app. Personally, I primarily use basic HTTP authentication for an internal use app formerly deployed on Heroku and for st... Use react-responsive in React Native2023-02-11T00:00:00+08:00 2023-02-11T22:10:15+08:00 https://www.davidangulo.xyz/posts/use-react-responsive-in-react-native/ David Angulo If you have been coding React Native for a while you may have noticed that some of Web APIs aren’t implemented in React Native. If you also have been developing web apps using React you might have encountered react-responsive. It gives us the power to hook media queries onto our React components. The library have been utilizing Window.matchMedia() under the hood in matching media query string... Use getRandomValues in React Native2023-02-04T00:00:00+08:00 2023-02-04T19:47:16+08:00 https://www.davidangulo.xyz/posts/use-getRandomValues-in-react-native/ David Angulo If you have been coding React Native for a while you may have noticed that some of Web APIs aren’t implemented in React Native. One useful Web API that can be nice to have is Crypto.getRandomValues(). It allows us to generate cryptographically secure random values. Why do we need it? const array = new Uint32Array(3); crypto.getRandomValues(array); console.log(array); // Uint32Array(3) [910455... Use URL class in React Native2023-01-27T00:00:00+08:00 2023-01-27T23:00:38+08:00 https://www.davidangulo.xyz/posts/use-url-class-in-react-native/ David Angulo If you have been coding React Native for a while you may have noticed that some of Web APIs aren’t implemented in React Native. One Web API that I commonly use is the URL interface, it allows us to parse a URL, read, and modify them. Why do we need it? An example would be reading a query params from the URL. In a normal scenario we would treat a URL simply as string: const url = 'https://dav...