<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohammed Hammoud on Medium]]></title>
        <description><![CDATA[Stories by Mohammed Hammoud on Medium]]></description>
        <link>https://medium.com/@mohammedhammoud?source=rss-cb6a9dabdef0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q5mtjGlnfjWGN7UHh805Ug.jpeg</url>
            <title>Stories by Mohammed Hammoud on Medium</title>
            <link>https://medium.com/@mohammedhammoud?source=rss-cb6a9dabdef0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 13:05:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohammedhammoud/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to use .env in package.json]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-use-env-in-package-json-59136d671b3c?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/59136d671b3c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Sun, 29 Oct 2023 09:47:24 GMT</pubDate>
            <atom:updated>2023-10-29T09:47:24.826Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to use .env in package.json</h3><p>I’ve done this many times, but like every other developer, I often start by searching on Google. Unfortunately, many posts are long and confusing. Using <strong>dotenv-cl</strong>i for this task is pretty straightforward.</p><h4>1. Install dotenv-cli</h4><pre>yarn add dotenv-cli</pre><h4>2. Add an .env file to your root folder</h4><pre>BASE_API_URL=http://localhost:5001</pre><h4>3. Use dotenv in your package.json</h4><pre>{<br>  ...<br>  &quot;scripts&quot;: {<br>    ...<br>    &quot;dev&quot;: &quot;dotenv -- yarn build&quot;<br>  }<br>}</pre><p>Happy hacking ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59136d671b3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to test abstract models In Django]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-test-abstract-models-in-django-aeb8b3c8fc4a?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeb8b3c8fc4a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 20:26:12 GMT</pubDate>
            <atom:updated>2023-10-24T20:33:50.211Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently created an abstract model for handling soft deletions in Django and wanted to add some tests to verify the behaviour. Testing abstract models in Django can be challenging. However, a custom test case class simplifies the process by allowing you to create a dynamic model for testing your abstract model. I hate long blog posts, so lets cut to the chase, this is how I solved it:</p><pre>from django.db import connection<br>from django.db.models.base import ModelBase<br>from django.test import TestCase<br><br>class AbstractModelMixinTestCase(TestCase):<br>    mixin = None<br>    model = None<br><br>    @classmethod<br>    def setUpClass(cls) -&gt; None:<br>        cls.model = ModelBase(<br>            &quot;TestModel&quot; + cls.mixin.__name__,<br>            (cls.mixin,),<br>            {&quot;__module__&quot;: cls.mixin.__module__},<br>        )<br><br>        with connection.schema_editor() as editor:<br>            editor.create_model(cls.model)<br><br>        super().setUpClass()<br><br>    @classmethod<br>    def tearDownClass(cls) -&gt; None:<br>        super().tearDownClass()<br><br>        with connection.schema_editor() as editor:<br>            editor.delete_model(cls.model)<br><br>        connection.close()</pre><p>And this is how I use my mixin:</p><pre>from common.tests.base import AbstractModelMixinTestCase<br><br>class SoftDeletionModelTestCase(AbstractModelMixinTestCase):<br>    mixin = SoftDeletionModel<br><br>    def test_soft_delete_instance(self):<br>        instance = self.model.objects.create()<br>        instance.delete()<br>        self.assertIsNotNone(instance.deleted_at)</pre><p><em>Tested with Django 4.1.2 ❤️</em></p><p>Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeb8b3c8fc4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install an npm package from GitHub]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-install-an-npm-package-from-github-fb039ef2d4ec?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb039ef2d4ec</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[npm]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Mon, 31 Jul 2017 16:01:01 GMT</pubDate>
            <atom:updated>2017-07-31T16:01:01.808Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes the JavaScript package you want to install has not been published to the <em>npm registry</em> and you really want to install the npm package directly from Github or a another repository hosting service. The easiest way to do that successfully is by typing the following line in your terminal:</p><pre>npm install git+https://<a href="/service/mailto:git@github.com">git@github.com</a>:iktw/react-native-hud-view.git</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb039ef2d4ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to avoid being asked for git passphrase]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-avoid-being-asked-for-git-passphrase-56795e77246f?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/56795e77246f</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Sun, 23 Jul 2017 22:01:00 GMT</pubDate>
            <atom:updated>2017-07-23T22:10:22.678Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok so this is super annoying. Every time i wanted to make <em>git pull/push </em>or whatever my terminal was prompting me for my git passphrase. After some research I found a quite simple solution for my problem. If you’ve got the same struggle and want to get rid of it follow the steps below:</p><p><strong>Open your terminal and start your ssh agent with:</strong></p><pre>eval $(ssh-agent)</pre><p><strong>Add your private key:</strong></p><pre>ssh-add</pre><p><strong>Save your private key for permanent use:</strong></p><pre>ssh-add -K</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56795e77246f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install pip on macOS or OS X]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-install-pip-on-macos-or-os-x-60e1e695812e?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/60e1e695812e</guid>
            <category><![CDATA[os-x]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Sun, 23 Jul 2017 06:01:02 GMT</pubDate>
            <atom:updated>2017-07-23T06:01:02.512Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok so you’re probably here because you want to know <em>how to install pip on maxOS or OS X</em>, well it’s quite easy.</p><p><strong>Open your terminal and type the following command:</strong></p><pre>sudo easy_install pip</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e1e695812e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Elasticsearch on startup]]></title>
            <link>https://medium.com/@mohammedhammoud/running-elasticsearch-on-startup-50199135068b?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/50199135068b</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Sat, 22 Jul 2017 06:01:01 GMT</pubDate>
            <atom:updated>2017-07-22T06:01:01.586Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently created my own Elasticsearch cluster, and for some reason,<em> I don’t know if it’s by default</em> but the Elasticsearch service didn’t start on boot. This could be really annoying if the server for some reason got rebooted or shut down. After some googling I found a really neat solution that solved my issue.</p><p><strong>Run the following lines on your machine:</strong></p><pre>sudo /bin/systemctl daemon-reload<br>sudo /bin/systemctl enable elasticsearch.service<br>sudo /bin/systemctl start elasticsearch.service</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50199135068b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Being a developer isn’t all sunshine and rainbows]]></title>
            <link>https://medium.com/@mohammedhammoud/being-a-developer-isnt-all-sunshine-and-rainbows-ddd2561d53b5?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddd2561d53b5</guid>
            <category><![CDATA[thoughts]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Fri, 21 Jul 2017 16:01:01 GMT</pubDate>
            <atom:updated>2017-07-21T16:01:01.041Z</atom:updated>
            <content:encoded><![CDATA[<p>Being a developer does not automatically mean that the creative part of the brain shuts down and that there is only one way to solve a task. A developer encounters daily a lot of limitations, sometimes due to knowledge breeze but in many cases due to the framework in use.</p><p>A developer is in such circumstances required to produce proposals for workarounds that he or she later (we’re talking years) can maintain, and support without having to sit down and try to understand how he or she thought from the beginning.</p><p>My point is that there may be a greater complexity than what a user sees when navigating from A to B. Take care of your developer, take care of me…</p><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddd2561d53b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to remove extra spaces in a JavaScript String]]></title>
            <link>https://medium.com/@mohammedhammoud/how-to-remove-extra-spaces-in-string-javascript-cb66a314643a?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb66a314643a</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 10:32:35 GMT</pubDate>
            <atom:updated>2017-07-20T11:34:46.300Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I wanted to remove extra spaces inside of string. The easiest way to do that was by extending JavaScript’s String object. You could obviously if you prefer just wrap the return statement inside of a function and use it on demand instead.</p><pre>String.prototype.removeExtraSpaces = function() {<br>   return this.replace(/\s+/g,&#39; &#39;).trim();<br>}</pre><pre>&gt; Run: &quot;This is     my string   &quot;.removeExtraSpaces();<br>&gt; <strong>Output:</strong> &quot;This is my string&quot;</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb66a314643a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fix locale.Error: unsupported locale setting]]></title>
            <link>https://medium.com/@mohammedhammoud/fix-locale-error-unsupported-locale-setting-f9849eec41f1?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9849eec41f1</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[localization]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Thu, 27 Apr 2017 10:01:01 GMT</pubDate>
            <atom:updated>2017-04-27T10:01:01.628Z</atom:updated>
            <content:encoded><![CDATA[<p>Ok, so I’ve just encountered the following error on my newly installed Ubuntu Machine: <strong><em>locale.Error: unsupported locale setting</em></strong> when I was trying create a virtual environment with <em>python-virtualenv</em>. After some googling i found the following solution:</p><pre>export LANGUAGE=en_US.UTF-8<br>export LANG=en_US.UTF-8<br>export LC_ALL=en_US.UTF-8<br>locale-gen en_US.UTF-8<br>sudo dpkg-reconfigure locales</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9849eec41f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL — Create User, Create Database, Grant privileges/access.]]></title>
            <link>https://medium.com/@mohammedhammoud/postgresql-create-user-create-database-grant-privileges-access-aabb2507c0aa?source=rss-cb6a9dabdef0------2</link>
            <guid isPermaLink="false">https://medium.com/p/aabb2507c0aa</guid>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Mohammed Hammoud]]></dc:creator>
            <pubDate>Wed, 26 Apr 2017 08:19:24 GMT</pubDate>
            <atom:updated>2017-07-22T14:18:00.232Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s assume that you’ve already have PostgreSQL installed on your Ubuntu machine and that you want to create a user, create a database and grant the user privileges to write/read to/from the database. The following steps should cover that:</p><h4>1. Switch to postgres user</h4><pre>sudo su postgres</pre><h4>2. Enter the the interactive terminal for working with Postgres</h4><pre>psql</pre><h4>3. Create the database (change database_name)</h4><pre>CREATE DATABASE database_name;</pre><h4>4. Create user (change my_username and my_password)</h4><pre>CREATE USER my_username WITH PASSWORD &#39;my_password&#39;;</pre><h4>5. Grant privileges on database to user</h4><pre>GRANT ALL PRIVILEGES ON DATABASE &quot;database_name&quot; to my_username;</pre><p>Happy hacking…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aabb2507c0aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>