Recently I’ve been trying to incorporate infrastructure as code in my project at the early stages so that it increases the efficiency, productivity, and confidence when it comes to deployment and testing. While working on setting up the IaC, I decided on three different stages which are development, staging, and production.
One issue that I have stumbled on is when I do some changes related to the resources that I have defined in pulumi and their configurations, running
pulumi preview is not enough to make sure that everything is working properly. I might have defined my resources correctly, and the
preview command will let me know about that, but my configurations such as the ports that have been defined on the application load balancer, or the security groups config haven’t been set correctly. Thus, after I have merged the feature branch to one of the branches such as
development, only later I would find out that not everything have been set correctly when trying to hit one of the endpoints. …
In this article, we will talk about the different topics that will lead us to understand better what the
new keyword does in JS.
__proto__property and its role when it comes to objects and the prototypal chaining
prototypeand the prototypal chain
newkeyword and how do the different pieces relate to it
The tweet which you can see below is asking whether all Objects have the prototype property [by default]. It sparked a lot of discussions, different answers, and people wondering if what they think is correct or not. …
Most probably you’re reading this because you are probably developing a blog using Django. It’s something I actually was searching all over the internet 2 years ago when I started learning python, and couldn’t find examples online. Took me weeks, but I finally figured out, and was lucky enough to find a StackOverflow question that is asking the same question and I could answer it perfectly.
You’ll just need two models. One for the Post and the other would be for the Images. Your Images model would have a ForeignKey to the Post model:
user = models.ForeignKey(User)
title = models.CharField(max_length=128)
body = models.CharField(max_length=400)
def get_image_filename(instance, filename):
id = instance.post.id
return "post_images/%s" % (id)
post = models.ForeignKey(Post, default=None)
image = models.ImageField(upload_to=get_image_filename, …
Fractals are great, and I started using them in project Rawag, but after updating the old code for a speed performance update, I needed to return a fractal in a custom response. The reason behind this was I only wanted to load specific data for a JSON response, because returning a fractal for a whole Collection the loading time is very slow, so I needed a smaller JSON response.
I’m using laravel-fractal https://github.com/spatie/laravel-fractal
So instead of returning a collection with nested collections:
return $this->response()->collection($reservations, new ReservationTransformer)->setStatusCode(200);
I can return a custom array with only the ‘Fracteled’ data that I need, which in this case just the property.
"id" => $reservation->id,
"reference" => $reservation->reference,
"property" => (new PropertyTransformer)->transform($reservation->property)