<?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[Mozaix LLC - Medium]]></title>
        <description><![CDATA[Web and mobile development company trying to make the IT world a better workplace. - Medium]]></description>
        <link>https://medium.com/mozaix-llc?source=rss----2f87df735096---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Mozaix LLC - Medium</title>
            <link>https://medium.com/mozaix-llc?source=rss----2f87df735096---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:51:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/mozaix-llc" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A card that requires login (HTML,CSS,jQuery)]]></title>
            <link>https://medium.com/mozaix-llc/a-card-that-requires-login-html-css-jquery-98454f6d61a5?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/98454f6d61a5</guid>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[scss]]></category>
            <dc:creator><![CDATA[Labinot Jaha]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 22:56:58 GMT</pubDate>
            <atom:updated>2020-03-30T22:56:58.852Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f-z41QmU13vVNU6m" /><figcaption>Photo by <a href="https://unsplash.com/@leecampbell?utm_source=medium&amp;utm_medium=referral">Lee Campbell</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There is a card I had to work on a long time ago, so I decided to share it with you. It’s a card ( not the most beautiful one ) that has some images inside and if you wanna scroll inside will require a login to do it, the login is simple is just a click on this sample but… yea this is the idea behind.</p><p>Let’s go…</p><h3>First the HTML code</h3><p>Okay, there is the main div that has inside the header with an image, the body that there are some divs with images inside that can be scrolled horizontally and there is the hover div that has login button that will come out if you hover on the card.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*uVrPMNub5DAS_uro7BrreA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aab43648d64732819719d39c673f74c0/href">https://medium.com/media/aab43648d64732819719d39c673f74c0/href</a></iframe><h3>CSS code</h3><p>So, besides the style that I’m doing with CSS there is the login-hover class that is positioned absolute on the card div (that has relative). So when we hover on the card the login-hover will show and it has a button inside.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c644c86646366d7bbd2b6b307ca47c9c/href">https://medium.com/media/c644c86646366d7bbd2b6b307ca47c9c/href</a></iframe><h3>Javascript(jQuery) code</h3><p>Little of JS code, it’s only removing that hover div when button Login is clicked, and it will bring back when we click the button outside the card.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*drCM8OwImqX-jJZnj95DLQ.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e45efd9e994d1368501677d90bb65d3/href">https://medium.com/media/9e45efd9e994d1368501677d90bb65d3/href</a></iframe><p>I hope this will make use of you one day, there is the codepen link to check how it works <a href="https://codepen.io/lbnt/pen/RwPvqyK">https://codepen.io/lbnt/pen/RwPvqyK</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98454f6d61a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/a-card-that-requires-login-html-css-jquery-98454f6d61a5">A card that requires login (HTML,CSS,jQuery)</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to quickly get the dates for the first 10 Mondays using Ruby]]></title>
            <link>https://medium.com/mozaix-llc/how-to-quickly-get-the-dates-for-the-first-10-mondays-using-ruby-cc31deeb48e0?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/cc31deeb48e0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[language]]></category>
            <category><![CDATA[mondays]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 18 Nov 2018 17:30:23 GMT</pubDate>
            <atom:updated>2018-11-18T17:30:28.576Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*l2j5gP1mDb-rsf7h.png" /></figure><p>If you are sometimes feeling bored and want to entertain yourself, then rather than aimlessly scrolling in a social media, you can try to learn something new. For example, you can learn something that you have not known that you can do with Ruby: Getting the dates for next <em>Mondays</em>, <em>Tuesdays</em> or any other day of the week.</p><p>Here is how you do it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9302ec923c0527390247b753e813cfd0/href">https://medium.com/media/9302ec923c0527390247b753e813cfd0/href</a></iframe><p>After you execute it, you will see the list of the dates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NEwmFP3gvIHZIwz3tSudCQ.png" /></figure><p>We can replace the part <em>monday </em>with any other name of the days of the week in English and it will work fine.</p><p>I know that this may look like something that may not be that much benefit, but maybe, you could use it in a personal script that you have. In a better case, I hope this inspires you to explore more in the documentation of a programming language that you use so that you can learn more hidden gems that can save you a lot of time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc31deeb48e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/how-to-quickly-get-the-dates-for-the-first-10-mondays-using-ruby-cc31deeb48e0">How to quickly get the dates for the first 10 Mondays using Ruby</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get your user’s age in Rails]]></title>
            <link>https://medium.com/mozaix-llc/how-to-get-your-users-age-in-rails-65c810ab1395?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/65c810ab1395</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[calculate]]></category>
            <category><![CDATA[age]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 22 Apr 2018 19:59:15 GMT</pubDate>
            <atom:updated>2018-04-18T05:08:04.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*HtfdaofXnZcGJDqJOm8xZA.jpeg" /><figcaption>Img source: lynda.com</figcaption></figure><p>If you have a certain type of policy for not allowing users of all ages to use your services, or simply want to find the age of your users, then you can do it pretty easily and elegantly in Rails.</p><p>Craig Sheen has already written a <a href="https://medium.com/@craigsheen/calculating-age-in-rails-9bb661f11303">topic</a> on he addressed this issue, and I also wanted to write about it here.</p><p>He mentioned that he made several attempts (as it normally takes), until he finally managed to stumble upon a clear and elegant way.</p><p>He initially tried a very intuitive initiative:</p><p>Time.zone.now.year - date_of_birth.year</p><p>However, this does not take into consideration the months, nor the days of the months. For example, if your user is born on 28 November 1993, and you are executing the above on 2 February 2018, then you are actually making this user look many months older than he or she actually is, because the output of the above expression will be 25.</p><p>Craig mentioned that he Googled and found out the expression below, which accurately calculates the age, but seems a bit messy, and is hard to understand.</p><pre>now = Time.zone.now.to_date<br><br>now.year - date_of_birth.year - ((now.month &gt; date_of_birth.month || (now.month == date_of_birth.month &amp;&amp; now.day &gt;= date_of_birth.day)) ? 0 : 1)</pre><p>He mentioned that he managed to reach the solution below, which is very elegant and accurate:</p><p>((Time.zone.now - date_of_birth.to_time) / 1.year.seconds).floor</p><p>This takes into consideration the timezone, and even the seconds. When the division is done, then this expression does a round down to the next smallest integer.</p><p>That’s basically it.</p><p>There are many helper methods that are related to <em>DateTime</em> and <em>Time</em> in Rails, like the following, which make programming in Rails really great:</p><p>DateTime.now.midnight</p><p>DateTime.now.beginning_of_day</p><p>Seeing all these simplified methods for doing things, It may not be of big surprise if we were to see new methods being added calculating someone’s age, or other information inside Rails.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65c810ab1395" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/how-to-get-your-users-age-in-rails-65c810ab1395">How to get your user’s age in Rails</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inform your users about breached passwords using Pwned Passwords API]]></title>
            <link>https://medium.com/mozaix-llc/inform-your-users-about-breached-passwords-using-pwned-passwords-api-93c6e320f956?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/93c6e320f956</guid>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[lake]]></category>
            <category><![CDATA[breach]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 22 Apr 2018 19:58:29 GMT</pubDate>
            <atom:updated>2018-04-22T19:58:16.900Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*sTKtQO8J73rczX06.png" /><figcaption>Img source: dev.to</figcaption></figure><p>Passwords one of the most frequent ways that we use to access our digital accounts. Having secure passwords is really crucial, and represents one of the most important aspects that we need to pay attention to. As developers, we also need to make sure that we provide our services with a high level of security. Last year 2017 <a href="https://en.wikipedia.org/wiki/National_Institute_of_Standards_and_Technology">NIST (National Institute of Standards and Technology)</a> recommended to check user passwords against existing public breaches of data, and fortunately, there exists an API that allows you to do that really easily.</p><p>The Pwned Passwords API is a service that you can use to check whether a password has been exposed as part of a number of numerous data breaches that have occurred several times in the past. These data contain more than 500,000,000 passwords that have been used before.</p><p>You can install this in your Ruby applications using the following gem as a wrapper:</p><p>gem &#39;pwned&#39;</p><p>After you have installed it, you can create a new this Pwned::Password object and then check if it has been breached:</p><p>password = Pwned::Password.new(&quot;password&quot;)</p><p>You can also check how many times the password appears in the dataset.</p><pre>password = Pwned::Password.new(&quot;password&quot;)<br><br>password.pwned_count<br><br>#=&gt; 3303003</pre><p>As you may probably be using this service as part of the sign up process, you are supposed to also take into consideration the fact that this service may not be working sometimes:</p><pre>begin<br><br>  password = Pwned::Password.new(&quot;password&quot;)<br><br>  password.pwned?<br><br>rescue Pwned::Error =&gt; e<br><br>  # Ummm... don&#39;t worry about it, I guess?<br><br>end</pre><p>You can also make this API call a lot easier using the following:</p><p>Most of the times you only care if the password has been pwned before or not. You can use simplified accessors to check whether the password has been pwned, or how many times it was pwned:</p><pre>Pwned.pwned?(&quot;password&quot;)<br><br>#=&gt; true<br><br>Pwned.pwned_count(&quot;password&quot;)<br><br>#=&gt; 3303003</pre><p>You can also validate your models like the following:</p><pre>class User &lt; ApplicationRecord<br><br>  validates :password, not_pwned: true<br><br>  # or<br><br>  validates :password, not_pwned: { message: &quot;has been pwned %{count} times&quot; }<br><br>end</pre><p>You can even set a threshold that you believe should be used to warn a user about a password that has been breached. For example, you may think that a password that has appeared only 2 times is not a problem:</p><pre>class User &lt; ApplicationRecord<br><br>  # The record is marked as valid if the password has been used once in the breached data<br><br>  validates :password, not_pwned: { threshold: 2 }<br><br>end</pre><p>If you are using <em>Devise </em>for your authentication, there is another specific <a href="https://github.com/michaelbanfield/devise-pwned_password">gem</a> prepared specifically for this.</p><p>You can learn more about this gem and its implementation by visiting its <a href="https://github.com/philnash/pwned">Github page</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93c6e320f956" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/inform-your-users-about-breached-passwords-using-pwned-passwords-api-93c6e320f956">Inform your users about breached passwords using Pwned Passwords API</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Find out which gems are consuming the most of your memory with Derailed]]></title>
            <link>https://medium.com/mozaix-llc/find-out-which-gems-are-consuming-the-most-of-your-memory-with-derailed-ab0c228a8b06?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab0c228a8b06</guid>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 01 Apr 2018 18:36:00 GMT</pubDate>
            <atom:updated>2018-03-18T19:41:14.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7Je78GPPlBJFLYKw.png" /></figure><p>Img source: blog.honeybadger.io</p><p>Rails gives you a lot of great ways for rapid development, but there comes a time when your application is already mature and needs to be optimized, because it has become slow. The more gems you add to it, the slower it tends to get. Each gem you add in your project will increase the level of RAM this app consumes. Here is a gem called <em>derailed</em> that can help you learn about other gems, developed by Richard Schneeman.</p><p>You can install it as any other <a href="https://github.com/schneems/derailed_benchmarks">gem</a>:</p><p>gem ‘derailed’, group: :development</p><p>If you also want to get all other profiling tools, add the following gem as well:</p><p>gem “stackprof”, group: :development</p><p>Then you can see exactly how much memory each of your gems requires at compile time.</p><p>Derailed can give information about your project by sending requests against your web app and benchmarking it, or it can also learn from the dependencies that are in your Gemfile. You can learn a lot more about it by reading its README on <a href="https://github.com/schneems/derailed_benchmarks">Github.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab0c228a8b06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/find-out-which-gems-are-consuming-the-most-of-your-memory-with-derailed-ab0c228a8b06">Find out which gems are consuming the most of your memory with Derailed</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moment is a lightweight JavaScript library that helps you work with dates]]></title>
            <link>https://medium.com/mozaix-llc/moment-is-a-lightweight-javascript-library-that-helps-you-work-with-dates-89c4183575fe?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/89c4183575fe</guid>
            <category><![CDATA[compare]]></category>
            <category><![CDATA[date]]></category>
            <category><![CDATA[javasript]]></category>
            <category><![CDATA[before]]></category>
            <category><![CDATA[after]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 01 Apr 2018 18:35:40 GMT</pubDate>
            <atom:updated>2018-03-18T19:48:15.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zm5IvFBIsZkRM52W.png" /></figure><p>Img source: christosfellas.com</p><p>One of the best JavaScript libraries for working with dates is <em>moment</em>. It is really easy to install, use and has many functions that help you with <em>parsing, validating, manipulating and formatting dates</em>.</p><p>You can install it using <em>npm</em> using the following command:</p><pre>npm install moment</pre><p>Its <a href="http://momentjs.com/docs/">documentation</a> demonstrates how you can also install and use it using other ways like Bower, NuGet, meteor and many others.</p><p>Some of use cases of <em>moment </em>can be seen down below:</p><ul><li>Get current date:<br> moment();</li><li>Create a moment from a string:<br> var day = moment(&quot;2018-03-18&quot;);</li><li>Validate a date:<br> moment().isValid();</li><li>Find a later date:<br> invalid.add(unit, value)</li><li>Check if a date is after another date:<br> date.isAfter(another);</li><li>Check if a date is same or after another date:<br> moment(&#39;2018-03-20&#39;).isSameOrAfter(&#39;2018-03-19&#39;);</li><li>Check if a date is before another date:<br> date.isBefore(another)</li><li>Check if a date is same or before another date:<br> moment(&#39;2010-10-20&#39;).isSameOrBefore(&#39;2010-10-21&#39;);</li><li>Check if a year is leap year<br> moment().isLeapYear();</li></ul><p>You can learn about it by reading its <a href="http://momentjs.com/docs/">documentation</a>. This library is open source and can be found on <a href="https://github.com/moment/moment">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89c4183575fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/moment-is-a-lightweight-javascript-library-that-helps-you-work-with-dates-89c4183575fe">Moment is a lightweight JavaScript library that helps you work with dates</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get previous values of model attributes in Rails using a pre-existing helper]]></title>
            <link>https://medium.com/mozaix-llc/get-previous-values-of-model-attributes-in-rails-using-a-pre-existing-helper-5be6d1c52760?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/5be6d1c52760</guid>
            <category><![CDATA[attributes]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 01 Apr 2018 18:35:25 GMT</pubDate>
            <atom:updated>2018-03-25T16:31:14.706Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*6hPLEzpdSFREWrWV.png" /></figure><p>Img source: binarywebpark.com</p><p>One of the best practices is keeping your controllers with as little code as possible, and have all the validations in the models. Rails includes a lot of validations that you can use in your models, and many other helpers that help you focus on your business logic and develop your projects as quickly as possible. A helper method that is among the unpopular ones is the possibility to check the old value of an attribute of a object, before doing any database transaction.</p><p>This method is ATTRIBUTE_was, where ATTRIBUTE represents a model’s attribute.</p><p>Let’s take an example to understand it a little better.</p><p>Suppose that you have an attribute called <em>color</em> and you are trying to update this attribute only in cases when it was previously a blue color. In this case, we can have the following:</p><pre>before_update :update_color<br><br>  def update_color<br><br>    if color_was == Color.BLUE <br><br>      write_attribute(:color, color) <br><br>    end<br><br>  end</pre><p>The callback added will make sure this method is called each time an object of this model is being updated.</p><p>This is just a small thing, but that is surprisingly not that much known and can be something useful that you can use in your models.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5be6d1c52760" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/get-previous-values-of-model-attributes-in-rails-using-a-pre-existing-helper-5be6d1c52760">Get previous values of model attributes in Rails using a pre-existing helper</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A quick shortcut for quickly navigating in Github repositories]]></title>
            <link>https://medium.com/mozaix-llc/a-quick-shortcut-for-quickly-navigating-in-github-repositories-9dbc408f5e6a?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/9dbc408f5e6a</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[collaborate]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 01 Apr 2018 18:35:06 GMT</pubDate>
            <atom:updated>2018-04-01T18:34:54.719Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xE2iJ_nnO7RrzWTp.png" /></figure><p>GitHub is one of the best places for developers to store their projects, collaborate with other colleagues, and learn from other open source projects as well. These type of projects are written in different programming languages, usually using different frameworks. As these frameworks or developers in general usually possess certain ways of organizing their code files into many folders, it makes it a bit difficult to navigate through them manually in GitHub. Luckily there is a really helpful shortcut that help with that.</p><p>If you go to a GitHub repository and press <em>T</em> in your keyboard, you can then start typing the name of the file that you want to open. This way you are able to go to specific files as fast as your typing rather than having to go to that particular file after going through multiple nested folders inside your project. You can then use upward and downward keys on your keyboard to navigate through the files, e<em>nter</em> to view files, or <em>esc </em>to exit.</p><p>This is something really simple, but that I personally find very useful, as it saves me a lot of time when I am trying to find a particular file. It is not meant that this will now be sufficient and capable of avoiding the need to use the usual lookup through folder pages. It is simply a quick shortcut that you can use to go to files, or folders that you are already aware of really quickly. You can still use the usual way of navigating through your project files, and have this shortcut off your sleeve from time to time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dbc408f5e6a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/a-quick-shortcut-for-quickly-navigating-in-github-repositories-9dbc408f5e6a">A quick shortcut for quickly navigating in Github repositories</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write complex queries using Globalize gem in Rails applications]]></title>
            <link>https://medium.com/mozaix-llc/how-to-write-complex-queries-using-globalize-gem-in-rails-applications-f2af2a5ab5a2?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/f2af2a5ab5a2</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[application]]></category>
            <category><![CDATA[translate]]></category>
            <category><![CDATA[globalize]]></category>
            <category><![CDATA[gem]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Mon, 05 Mar 2018 07:49:17 GMT</pubDate>
            <atom:updated>2018-03-04T19:32:25.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*oHh3xxPGxuvW-mVo.jpg" /></figure><p>Img source: railscarma.com</p><p>Globalize is one of the most famous gems that is used for translating dynamic content in Rails application. It is really easy to use, and brings a lot of conveniences immediately after you add it in your application. I recently had to do a more complex query using the table added by Globalize generator, and I could not find that much information about ways of doing joins for this newly added table with the one that it corresponds and that translates its attributes. In this article, you can see a short example on how to do that.</p><p>To illustrate this, I am going to take a very quick example. If you have a table called <em>Post</em>, and want to query posts that have a certain pattern of <em>title </em>in a particular translation, then you may start to write the following:</p><pre>Post.where(“title iLIKE ?”, &quot;%#{pattern}%&quot;)</pre><p>The following query will be executed:</p><pre>SELECT \&quot;posts\&quot;.* FROM \&quot;posts\&quot; WHERE (title LIKE &#39;TEST&#39;)</pre><p>If you write the following, you will see the <em>join </em>being done as expected:</p><pre>Post.with_translations(I18n.locale).where(“post_translations.title iLIKE ?”, &quot;%#{pattern}%&quot;)</pre><p>This will yield:</p><pre>SELECT \&quot;posts\&quot;.* FROM \&quot;posts\&quot; INNER JOIN \&quot;post_translations\&quot; ON \&quot;post_translations\&quot;.\&quot;post_id\&quot; = \&quot;posts\&quot;.\&quot;id\&quot; WHERE \&quot;post_translations\&quot;.\&quot;title\&quot; = &#39;Test&#39; AND \&quot;post_translations\&quot;.\&quot;locale\&quot; = &#39;en&#39;</pre><p>The key part of doing the join is <em>with_translations(I18n.locale)</em>, which also searches in the locales that you have already set in your application.</p><p>Although this is just a quick method invocation, it is really helpful in cases when you are doing these types of <em>queries</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2af2a5ab5a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/how-to-write-complex-queries-using-globalize-gem-in-rails-applications-f2af2a5ab5a2">How to write complex queries using Globalize gem in Rails applications</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rename Rails controllers, views and migrations with Rails Refactor]]></title>
            <link>https://medium.com/mozaix-llc/rename-rails-controllers-views-and-migrations-with-rails-refactor-911c26728b40?source=rss----2f87df735096---4</link>
            <guid isPermaLink="false">https://medium.com/p/911c26728b40</guid>
            <category><![CDATA[refactor]]></category>
            <category><![CDATA[model]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[names]]></category>
            <category><![CDATA[controller]]></category>
            <dc:creator><![CDATA[Fatos Morina]]></dc:creator>
            <pubDate>Sun, 25 Feb 2018 19:07:38 GMT</pubDate>
            <atom:updated>2018-02-25T19:08:25.303Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MslhFli8TzmZm50N.jpg" /><figcaption>Img source: <a href="https://www.youtube.com/watch?v=-sX05s0STs8">https://www.youtube.com/watch?v=-sX05s0STs8</a></figcaption></figure><p>There can be cases where you wished you named that controller a lot better, as it does not make any sense and is very ambiguous in its current form. If you have ever wondered whether there is a way for you to do quick renamings of multiple related files inside a Rails project, then I have some good news for you. There is already a gem called Rails Refactor, that can be used to do these renamings.</p><p>It is really simple and easy to use. As with any other Rails gem, you can install it quite easily by putting the following in your Gemfile:</p><p>gem install rails_refactor</p><p>Then you obviously need to restart your server and expect this gem to be available inside your project.</p><p>To rename a controller, you can simply use the following command:</p><p>rails_refactor rename OldController NewController</p><p>This will:</p><p>* rename controller file &amp; class name in file</p><p>* rename controller spec file &amp; class name in file</p><p>* rename view directory</p><p>* rename helper file &amp; module name in file</p><p>* update routes</p><p>You can also rename only a controller model using the following:</p><p>rails_refactor rename DummyController.old_action new_action</p><p>* renames controller action in controller class file</p><p>* renames view files for all formats</p><p>You can rename a model using the following:</p><p>rails_refactor rename OldModel NewModel</p><p>This will:</p><p>* rename model file &amp; class name in file</p><p>* rename spec file &amp; class name in file</p><p>* rename migration &amp; class name &amp; table names in file</p><p>You can view the source code of this project on its <a href="https://github.com/jcrisp/rails_refactor">Github page</a> and can also contribute and make it even better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=911c26728b40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mozaix-llc/rename-rails-controllers-views-and-migrations-with-rails-refactor-911c26728b40">Rename Rails controllers, views and migrations with Rails Refactor</a> was originally published in <a href="https://medium.com/mozaix-llc">Mozaix LLC</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>