- API Testing in FastAPI with Dependency Injection and Mock ObjectsMocking and dependency injection are tools that can help you test API endpoints without sending emails or connecting to a live database! With these tools, you can automatically confirm that your app responds to requests with different headers and cookies. In this post, I will show how to create mocks for a SQLAlchemy database and
- Learn How to Optimize Python with Coding ChallengesKnowing how to optimize code can help you in a pinch. You can practice with coding challenges, and HackerRank is a good source of them. (This is not a sponsored post). Some of the problems come with large test cases of their own that will force you to optimize your solutions. Here’s one: the Piling
- Make a File Tree Browser with AJAX and JSTreejsTree is a neat little tool that provides a tree interface in the browser. This is great for browsing images and other media. Here is a basic example to get you started with jsTree. This example makes AJAX requests to a server. The server responds with JSON, which is used to populate the tree. I
- Update Your CSS Without Refreshing the Page with Live.js!Live.js and Middleman are both pretty cool, and you can use them together to harness the power of style injection. If you’re a Mac user, stop reading and go use CodeKit. Okay, maybe read this first. If you’re like me, and you use Linux, read on. What is style injection? It means that your stylesheets
- Purely Functional Programming in JavaScriptThis article on functional programming is incredible. It’s a fun exercise that helped me understand the functional approach to writing software. I highly recommend it. List Out of Lamba: Steve Losh
- Stop using timeouts with SWTBot: Custom ConditionsI’ve seen a lot of test code that looks like this: Fixed waits like this are pretty standard, but they can cause problems later. If this is a resource-intensive proccess, your test could break in these cases: Fixed waits can also make your code harder to read, because it isn’t always easy to see what’s
- Show Beautiful Math on Your Blog With MathJaxMathJax uses JavaScript to interpret MathML and LaTeX on your website and display it in any browser. It’s wonderful, because the math looks beautiful and anyone can reuse the equations from your site as MathML or LaTeX. To begin using it, just paste the following above your </head> tag. (For wordpress, there’s a plugin). That’s it!