teleren/devto huggingface dataset:
Top 15 App Review Sites
Tags: android, ios, beginners, appmarketing
Published: 2019-12-22 17:49:41

---
title: Top 15 App Review Sites
published: true
description: Get your app featured on these top 15 app review sites to get more downloads and increase your app visibility. 
tags: android, iOS, beginners, app marketing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/58hrvzrudtr6srxn0pb6.jpg
---

Comprehensive and detailed app reviews showcase what exactly it has to offer to its users. App reviews are major decision-making factors for users, especially when they have to spend their hard-earned dollars to use your app. 

On the other hand, for app owners and developers, it is the perfect way to pitch their app in front of a targeted audience and gain more customers. In this article, we have a treat for both parties. 

Here we have compiled a list of top 20 [app review sites](https://www.codeitbro.com/top-app-review-sites/). Pitch your app or app idea to these websites to get your app reviewed and featured on these platforms.

1. TechCrunch
2. MobileAppDaily
3. 148Apps
4. Mashable
5. TechCrunch
6. GetApp
7. FeedMyApp
8. AppAdvice
9. The StartUp Pitch
10. BetaList

Read more info about these websites [here](https://www.codeitbro.com/top-app-review-sites/)
Daily Challenge #141 - Two Sum
Tags: challenge
Published: 2019-12-22 17:29:33

---
title: Daily Challenge #141 - Two Sum
published: true
series: Daily Challenge
description: Find two numbers in the array to reach the target value.
tags: challenge
---
Write a function that takes an array of integers and a target number. 

The function should find two different integers in the array that give the target value when added together. Return the indices in a tuple [e.g. (index1, index2)]. Some tests will have multiple solutions. 

**Test Cases**
`[1234,5678,9012], 14690`
`[1,2,3], 4`
`[2,2,3], 4`
`[5,10,15,20,25,30], 50`

Happy coding!

***
_This [challenge](https://www.codewars.com/kata/two-sum) comes from wthit56 on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
web-extension - cross-browser compatibility - Firefox, Chrome, Opera in one line
Tags: webextension, crossbrowser, javascript, compatibility
Published: 2019-12-22 16:48:08

```javascript
// this line make your web-extension compatible with Firefox, Chrome/Chromium and Opera 
const nav = chrome?chrome:browser;

// you can now use the nav namespace object and use callback functions, for examle :
// nav.storage.local.remove(name);

// I use this peace of code in the FocusJUMP extension, Test it and say me what you think about :)
// https://sebastienaubry.pagesperso-orange.fr/focusjump/
```
Python mocks can be better than just Mock()
Tags: python, testing
Published: 2019-12-22 16:24:47

I’ve seen a lot of examples where mock objects are badly used in Python unit tests. A lot of people seem to be guilty of only reading the first few paragraphs of the [unittest.mock documentation](https://docs.python.org/3/library/unittest.mock.html), resulting in some very fragile tests that end up just being a cause of frustration.

My background is primarily as a Java developer, so when I picked up Python I was quite shocked by how lax Python mocks appeared to be, if you feel the same then this may help.


## Lets get right into it…

So we have an object we want to use, perhaps it’s from a library and changes often but currently it looks like this:
{% gist https://gist.github.com/MGough/c0eff7aa71c1a316bffc35cd942c12b6 %}

We also have our object that we want to test:

{% gist https://gist.github.com/MGough/d7cfe4cdffa0c50cd891fabde3178ff8 %}

Looks like we’re going to need to mock SomeClassOutOfOurControl. Here’s an example of the most common ways I see it done, probably because it’s how a lot of other blogs tell you to do it:

{% gist https://gist.github.com/MGough/24e2670a9656c8c19811965ed0c9f24f %}

Yay mocks! But **this is fragile**… If there is a typo in our class or an interface change in the imported class then the tests can still pass. Swap out the imported class for this one and watch as magically nothing changes:

{% gist https://gist.github.com/MGough/08ef5a3dd9339d12ef4b2d94f13a6f72 %}

Despite the fact we call SomeClassOutOfOurControl.add() with 2 arguments the tests continue to pass when it only accepts one.

## How can we fix this?

There’s a super simple solution to this, and it’s called [autospeccing](https://docs.python.org/3/library/unittest.mock.html#auto-speccing). This means that your mocks are limited to have only the method which exist on the class being mocked, including the number of arguments. It can also handle attributes, but those are a special case, as those defined in functions aren’t included so I’d strongly recommend reading the docs.

{% gist https://gist.github.com/MGough/8894e0f7cdcb21b11714ed4be46e15e2 %}

Now we have mocks that are slightly more resilient! This of course doesn’t change the need for other levels of testing (integration or component level testing) but it makes our unit tests a bit more sensible.

If this seems like it would be useful to you then I highly recommend reading the unittest.mock documentation thoroughly. If you’ve received a technical test and there’s a chance I will be reviewing it then I’d definitely recommend reading the documentation, bonus points if you post a correction to this blog :).


Cover photo by [Maarten van den Heuvel on Unsplash](https://unsplash.com/@mvdheuvel?utm_medium=referral&amp;utm_campaign=photographer-credit&amp;utm_content=creditBadge)
How would you deploy parts of a monorepo in CI?
Tags: webdev, discuss
Published: 2019-12-22 15:27:16

---
title: How would you deploy parts of a monorepo in CI?
published: true
description: 
tags: webdev, discuss
---

With a monorepo with this kind of structure
```
.
├── api
│   └── index.js
└── web
    ├── index.html
    ├── main.css
    └── main.js
```

Assuming you changed the `web/index.html` and `web/main.css` files, in CI, how would you deploy only the `web` directory?

Vice versa if you only changed `api/index.js` only deploy the api, not the frontend.
Validasi Uniqueness Attribute antar Model dalam Rails
Tags: ruby, rails
Published: 2019-12-22 15:26:02

Beberapa waktu yang lalu saya menemui situasi di mana saya harus melakukan validasi uniqueness di antara dua model. Saya memiliki dua model yang sama-sama memiliki atribut `phone_number` dan dalam satu sistem yang saya bangun atribut ini harus unique.

Jika model A sudah memiliki `phone_number` 0811213305, maka model B juga tidak boleh memiliki `phone_number` dengan nomor yang sama.

Ruby on Rails memberikan kemudahan untuk melakukan *unique validation* dalam satu model dengan cara yang sangat mudah, namun tidak untuk *unique validation* dalam dua atau lebih model. Berarti, saya harus membuat sendiri validasi ini.

Setelah melakukan riset, maka saya pun menemukan algoritma yang menurut saya cukup simpel dan mudah untuk direproduksi sesuai kebutuhan.

Berikut adalah *code* saya:
```ruby
# app/models/concerns/validate_phone_number.rb
module ValidatePhoneNumber
    extend ActiveSupport::Concern

    @@included_classes = []

    included do
        @@included_classes << self
        validate :phone_number_in_all_model
    end

    private

    def phone_number_in_all_model
        return if self.phone_number.blank?
        @@included_classes.each do |klass|
            scope = klass.where(phone_number: self.phone_number)
            if self.persisted? && klass == self.class
                scope = scope.where('id != ?', self.id)
            end
            if scope.any?
                self.errors.add :phone_number, 'is already taken.'
                break
            end
        end
    end
end
```
Jangan lupa untuk `include Module` di dalam masing-masing model yang hendak divalidasi.
```ruby
# app/models/customer.rb
class Customer < ApplicationRecord
    include ValidatePhoneNumber
end


# app/models/branch.rb
class Branch < ApplicationRecord
    include ValidatePhoneNumber
end
```
Setelah memasukkan code ini, voila, maka atribut `phone_number` akan dipaksa untuk unique di kedua model, yaitu model Customer dan model Branch.

Kelemahan dari code ini adalah masih memungkinkannya terjadi duplikasi atribut ketika [*race condition*](https://stackoverflow.com/questions/34510/what-is-a-race-condition).

Semoga artikel ini bisa membantu yang sedang kesulitan.

Note:
- *Code* ini saya temukan di suatu artikel yang saya tidak bisa temukan lagi karena lupa kata kunci search google;
- Copas dari artikel saya
4.1 String formatting in python Part-2
Tags: python, beginners
Published: 2019-12-22 15:17:35

###**The new f-strings in Python 3 :-**
One of the many goodies packed into the new release are formatted string literals, or simply called “f-strings”.

First, they are called f-strings because you need to prefix a string with the letter “f” in order to get an f-string, similar to how you create a raw string by prefixing it with “r”, or you can use the prefixes “b” and “u” to designate byte strings and unicode strings.

The letter “f” also indicates that these strings are used for formatting.
Now Python already provides several ways for [formatting strings](https://dev.to/mohit355/4-1-string-formatting-in-python-29j6), so you may wonder why the Python gods introduced yet another way.

people who overlook the [Zen of Python](https://www.python.org/doc/humor/#the-zen-of-python) states that simple is better than complex and practicality beats purity - and yes, f-strings are really the most simple and practical way for formatting strings.

To create an f-string, prefix the string with the letter “ f ”. The string itself can be formatted in much the same way that you would with str.format(). F-strings provide a concise and convenient way to embed python expressions inside string literals for formatting.

For example:
```python
name='Mohit'
age=20
sentence=f"my name is {name} and i am {age} years old."
print(sentence)
```
Output is:
```python
my name is Mohit and i am 20 years old.
```
As you see, this works pretty much like the **.format()** method, however you can directly insert the names from the current scope in the format string. This is much simpler than the old way, and avoids duplication:
```python
name='Mohit'
age=20
sentence='He said his name is {name} and he is {age} years old.'.format(name=name, age=age)
print(sentence)
```
```python
He said his name is Fred and he is 42 years old.
```
Sure, you can omit the names inside the curly braces since Python 3.1, like this:
```python
name='Mohit'
age=20
sentence='He said his name is {} and he is {} years old.'.format(name,age)
print(sentence)
```
Same output appers:
```python
He said his name is Fred and he is 42 years old.
```
But still, this is longer and not as readable as the f-string notation.


And it gets even better than this, as f-strings also support any Python expressions inside the curly braces. You can also write triple-quoted f-strings that span multiple lines, like so:
```python
name='mohit'
seven=7
f'''He said his name is {name.upper()} 
and he is {6 * seven} years old.'''
```
Output is:
```python
'He said his name is MOHIT\n and he is 42 years old.'
```

=>> F-strings are faster than the two most commonly used string formatting mechanisms, which are % formatting and str.format().
I'm a professional React developer, and here's how I set up React/Node.js Microservices using Docker and GraphQL. #1
Tags: react, node, webdev, javascript
Published: 2019-12-22 13:52:02

**Update:** [Part 2 is out!](https://dev.to/bettercodingacademy/i-m-a-professional-react-developer-and-here-s-how-i-set-up-sequelize-with-mysql-inside-of-docker-compose-for-microservices-2-f0c)

**About Me:** I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at [Better Coding Academy](https://codebetter.com.au), and as part of what I do, I post videos on our YouTube channel at [https://www.youtube.com/c/BetterCodingAcademy](https://www.youtube.com/c/BetterCodingAcademy).

_(Subscribe for awesome web development content!)_

This is part 1 in a full tutorial on how to set up a React/Node.js app with a microservices architecture. In this project, I make use of:

- [React](https://reactjs.org/);
- [Node.js](http://nodejs.org/);
- [Docker and Docker Compose](http://docker.com/);
- [GraphQL](https://graphql.org/);
- [Sequelize](https://sequelize.org/) (with [MySQL](https://www.mysql.com/));
- [Redux](https://redux.js.org/);
- [Styled Components](https://styled-components.com/); and
- [React Hook Form](https://react-hook-form.com/).

I hope you enjoy!

{% youtube gD-WutJH0qc %}

Happy coding!

Full source code: [https://github.com/parkroolucas/microservices-demo](https://github.com/parkroolucas/microservices-demo)
Help! rectify Big O Notation, if wrong
Tags: help
Published: 2019-12-22 13:23:34

Please help me understand, what is the Order of Growth?
What is the Big O notation for this program

What i did so far?
I wrote this problem.
What is the Order of Growth according to me?
There are two access to array
1. once during this check, c[jumpLevel2]==0  , Worst case, n time access
2. Another during this, c[jumpLevel1]==0 , Worst case, n time access

So, 2N access
Therefore O(n)

Please correct me if I am wrong.

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    // Complete the jumpingOnClouds function below.
    static int jumpingOnClouds(int[] c) {
        int i=0;
        int path = 0;
        int clouds = c.length;
        while (i<clouds){
            int jumpLevel2 = i+2;
            int jumpLevel1 = i+1;
            if ((jumpLevel2<clouds) && c[jumpLevel2]==0){
                path+=1;
                i=jumpLevel2;
            } else if ((jumpLevel1<clouds) && c[jumpLevel1]==0){
                path+=1;
                i=jumpLevel1;
            } else {
                return path;
            }
        }
        return path;
    }

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

        int n = scanner.nextInt();
        scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

        int[] c = new int[n];

        String[] cItems = scanner.nextLine().split(" ");
        scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

        for (int i = 0; i < n; i++) {
            int cItem = Integer.parseInt(cItems[i]);
            c[i] = cItem;
        }

        int result = jumpingOnClouds(c);

        bufferedWriter.write(String.valueOf(result));
        bufferedWriter.newLine();

        bufferedWriter.close();

        scanner.close();
    }
}

Note: Code from Hackerrank, for my personal practise.
I am using dev.to platform to help understand my understanding. haha
A silly thing you can do with the Ruby parser
Tags: ruby
Published: 2019-12-22 13:12:52

Here's a silly thing you can do with the Ruby parser:

```ruby
begin
  raise "omg"
rescue =>
  (class Box
   class << self
     attr_accessor :contents
   end
end; Box).contents
end

puts Box.contents

# => "omg"
```

## You... what?

So let's break this down. In Ruby, the way one catches exceptions is with a
`begin...rescue...end` expression. The `rescue` part of that looks like this:
`rescue <class_name> => <assignable_expression>`. Usually you'd see something
like:

```ruby
begin
 ... whatever
rescue SomeClass => some_local_variable_name
  do_something_with_local_variable(some_local_variable_name)
end
```

However, it doesn't have to be this way. In fact, the Ruby parser permits any
valid assignment expression in Ruby! So we can for example set a key in a hash
from a rescue:

```ruby
h = {}
begin
  raise "omg"
rescue => h[:the_key]
end

puts h.inspect
# => {:the_key=>#<RuntimeError: omg>}
```

So, to come back to our first example:
```ruby
begin
  raise "omg"
rescue =>
  (class Box
   class << self
     attr_accessor :contents
   end
end; Box).contents
end

puts Box.contents

# => "omg"
```

Here we, **in the rescue clause**, define a class called box, define a class
level attribute called contents, and then set it. You shouldn't ever do this in
you production code, but it is possible.

## Why is this even possible?

As far as I can tell, the reason why this works as it does has to do with the
history of the implementation of Ruby. Before Ruby 1.9, Ruby used a "tree
walking" interpreter. This means that Ruby code was executed from the syntax
tree of the program, with no intermediate steps. Putting the rescued exception
"somewhere", conceptually, is the same thing as variable assignment, even though
it doesn't look like `local_name =`, so the code was shared between rescue and
variable assignment.

Neat!

If you enjoyed this post, please consider sending me a follow on twitter:
[@penelope_zone](https://twitter.com/penelope_zone).
I did it! I migrate from Jekyll to Gatsby
Tags: beginners, log, motivation, gatsby
Published: 2019-12-22 12:51:29

It's me again.

I am sharing that I am happy to be able to migrate my blog from Jekyll to Gatsby using [Lumen](https://www.gatsbyjs.org/starters/alxshelepenok/gatsby-starter-lumen/) starter. 
I ain't new because I came back and forth studying these past 10 years but I just restarted studying programming so this is huge for me. 

Also, I am working with Chatbots and AI now these past 4 months so any progress to my studies is a possible improvement in my job. Nevermind I am just writing here as an alternative log to my progress.
How to Install and Setup Python on Windows 10
Tags: python, help
Published: 2019-12-22 12:35:45

Python is a very powerful and yet simple programming language and it is available on a wide variety of platforms which includes Windows, Linux and Mac OS X. To start using Python, you’ve to understand how to install and set up the Python environment.

If you are a Windows 10 user and planning to learn Python and want to set it up, you are in the right place.

Below's a step by step video on how to do that:

{% youtube aU810VBfsN8 %}

If you can't watch the video for some reason, let's see how to just do that...

# Step 1: Downloading Python

There are two major Python versions: 2.7 and 3.x. However, support for 2.x will be dropping soon, so I'll suggest you go for 3.x. Moreover, by default, you will get the 3.x version if you trying to download from the python.org site now.

The latest and current source code, binaries, documentation, news, etc., are always available on the Python official website https://www.python.org/.

So head over to the download page: https://www.python.org/downloads/ to get the latest version.

# Step 2: Installing Python

Once you have successfully downloaded python, the next you would need to do is install it. Double click on the downloaded file and follow the installation instructions on the install wizard.

![installation options](https://mephyspa.sirv.com/How%20to%20Install%20And%20Setup%20Python%20on%20Windows%2010%20-%20YouTube%20-%20Google%20Chrome%2012_22_2019%201_07_56%20PM%20(2).png)

You can select either select any of the two options depending on how you want your python to be installed. However, I would suggest you go for the default one since it does the installation automatically. Also, ensure you check the `Add to Path` options. This helps you automatically add your Python Path to your system variables.

Once you have followed the installation instructions and successfully installed python, you should be able to use Python now.


Open your Windows 10 Command prompt. You can do that by using `Win + R` key combo and type in `cmd` and press enter. Then try running `python` and see if you get something like below:

![python cmd](https://mephyspa.sirv.com/2019-12-22%20(7).png)

then you are good to go. However, if you get something like below:

```bash
'python' is not recognized as an internal or external command,
operable program or batch file.
```

then that means your Python Path is not set correctly.

You can do that in the System Environment variables. You can follow the video below to see how to do that:


 {% youtube fsB-zrsLP_M %}

You can subscribe to my Youtube channel: [http://bit.ly/oyetoketoby](http://bit.ly/oyetoketoby)
404 CV Not Found Landing Page
Tags: codepen, html, css, web
Published: 2019-12-22 09:20:47

---
title: 404 CV Not Found Landing Page 
published: true
tags: codepen, html, css, web
---

{% codepen https://codepen.io/dytra/pen/MWYmeBK %}

<p>The goal of this pen is to attract recruiters to let them know that you really love coding in the web and hopefully this can make you get your first interview.</p>

<p>This pen suppose to be converted to PDF then the PDF can be attach to your LinkedIn Profile</p>

<p>This landing page talk to the readers that your CV isn't just a PDF file, it's an interactive cv! That's what the <strong>Get CV</strong> buton is for. Link the Get CV button to your interactive CV.</p>

<p>So what are you waiting for? Fork this pen, make it for your own and then  convert this pen to a pdf file. Use a free service like <a href="https://www.sejda.com/html-to-pdf">Sejda's HTML to PDF</a> and attach it in your LinkedIn profile or anything. Good luck!</p>

<p>Here's an example of the generated PDF using Sejda's HTML to PDF. <a target="_blank" href="https://www.icloud.com/iclouddrive/0Ec2pibBF8kTmWjo8dylngp_w#nocv_(2)">Download</a></p>

<p>Have some idea with this pen? Comment down bellow</p>
How to Generate Unique ID in JavaScript
Tags: javascript
Published: 2019-12-22 07:33:00

_Read the original article [here](https://rahmanfadhil.com/javascript-unique-id/)_

There are several ways to generate unique identifier in JavaScript. This could very useful in many cases, such as rendering list efficiently, or storing documents or records in database.

## Using UUID

UUID is the abbreviation of [univerally unique identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier), which is an identification number to uniquely identify something. The main idea of this thing is everytime we generate this numbers, it will be **universally** unique, which means no one could generate the exact same id as yours.

I personally prefer this approach in any case. In JavaScript, we can use a library called `uuid` to generate UUID.

```
$ npm install uuid
```

```js
const uuidv4 = require("uuid/v4")

uuidv4()
```

UUID has several versions, but the version that appropriate for generating unique id is version 4. And, that code will generate something like this.

```
1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed
```

## Using Math.random

[Math.random](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random) is a JavaScript built-in function which allows us to generate a random number. Which means that everytime we run it, it will return a unique combination of numbers.

```js
Math.floor(Math.random() * 100)
```

`Math.random` always returns a decimal number, so we need to rounding off that number first. By multiply it with 100, it will return any number between 0 to 99. You can increase the number if you want to get better result.

Result:

```
52
```

## Using Date.now

[Date.now](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now) is another JavaScript built-in function which allows us to get the number of miliseconds elapsed since January 1, 1970.

```js
Date.now()
```

Result:

```
1576996323453
```
Vagrant commands
Published: 2019-12-22 09:07:10

Vagrant commands which often use

1/ Initialization
vagrant init <pkg name>

2/ Start&Stop
vagrant up
vagrant halt

3/ Remove vm
vagrant box list (you can see the NAME of envs)
vagrant box remove NAME

4/ Remove whole config file
vagrant global-status (to list env ids)
vagrant destroy [name|id]

5/ Export VM box 
vagrant package

6/ Open VM box
vagrant init <NAME_OF_BOX>
vagrant up