Skip to main content

Posts

Showing posts with the label Javascript

Getting all deltas from Auth0

Before I get in to the solution of this article, let me tell you how it started and fill you in on the problem that arose.  I wrote a procedure to get daily deltas of users - those of which who had created/updated their account on the given day (and including the day before for good measure on the GMT timestamp).  The simple search criteria was just the following: updated_at:[yyyy-mm-dd TO yyyy-mm-dd] Simple, right?  the []'s being the dates are inclusive, while using {} would mean exclusively.  Auth0 lets you mix these on either side depending on your use.  While this is all well and good, Auth0 will limit the number of results (even with paging) to 1000 only. So, your first option is that you could have your procedure create a user export job, and then parsing through the results and eliminating those which do not meet your updated_at search criteria.  I can tell you first hand that eventually the amount of users will just get to be too much and cumb...

Text Manipulation

Today I want to share with you a few powerful examples of what you can do with ES6 - and a little out of the box thinking, and how much it will allow you to quickly scale up in a clean fashion. Cleaning Strings This for me was one of those "a Ha!" moments where the answer was just staring you in the face.  I had to include it since you may typically you might think to use some elaborate library.  Take the scenario where you present the user with an input box that allows for rich text, but you want the cleanest way to only store non-unicode characters.  Try this simple one-line gem: myCleanString = "test-_aaa'#@".replace(/[^0-9a-zA-Z-_' ]/gi, ''); The regular expression in this statement effectively says that for any characters not in this group (0-9, a-z, A-Z and symbol's hyphen, underscore, single quote and space), replace them with an empty string.  Do this for the characters of your choosing. DB Inserts/Updates Here I like to use the power of...