teleren/devto huggingface dataset:
What is Fundingrate.io?
Tags: showdev, hacktoberfest, javascript
Published: 2019-10-08 13:56:11

---
title: What is Fundingrate.io?
published: true
description: In this article we go into the process behind building Fundingrate.io, a simple Tradingview alert processing platform.
tags: #showdev #opensource #hacktoberfest #javascript
---

# Hello dev.to,

## Lets Get Started!

> I have been recently trading cryptocurrencies a lot this year using Tradingview.com and wanted to start automating some of my most profitable strategies. After a bit of research, I found that Tradingview did not have support for programmatically processing indicator alerts. The only solutions they had at the time were email scraping or sms processing.

## So, if thats that case why are we here?

> Recently, Tradingview released a update implementing webhook callbacks for indicator alerts. This changed everything! [Webhooks](https://en.wikipedia.org/wiki/Webhook) are very reliable ways to quickly get event message data sent to a client. :smile: However, this created a new challenge, I needed a way to capture the events using a public facing url.

{% github tacyarg/api.fundingrate.io %}

> api.fundingrate.io is a tool I created to solve the aforementioned problem of not having a way to capture Tradingview events reliably. Due to the recent release of the webhook feature, no other libraries existed and supported this method of event capture. The tradingview-listener has a format defined to make it simple and easy to collect any [arbitrary](https://www.lexico.com/en/definition/arbitrary) data you want. It also processes all events using the [NodeJS streaming API](https://nodejs.org/api/stream.html). This makes reprocessing of events fast, reliable and consistent. It is this flexibility that allows [Fundingrate.io](https://Fundingrate.io) to provide realtime analytical data for each user concurrently. 

{% github tacyarg/fundingrate.io %}

> [Fundingrate.io](https://Fundingrate.io) is the dashboard to manage your user, tokens, providers, and stats utilizing the [api.fundingrate.io](https://api.fundingrate.io). I wrote a simple easy to use frontend portal using react & styled-components in hopes to make the on-boarding process a bit smoother.

{% gist https://gist.github.com/tacyarg/c7f2cc5574218a008bd59e9a088c1a51 %}
JS Hack: Array & Duplicate Values
Tags: javascript, baredev, hack, watercooler
Published: 2019-10-08 13:51:11

---
title: JS Hack: Array & Duplicate Values
published: true
description: Simple and useful Array features in Javascript that are little known among developers.
tags: #javascript, #baredev, #hack, #watercooler
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0i4m24h5q2e9lwgl1aog.png
---

> ### This week's hack is about **cleaning duplicate values** from **Arrays**

## The **Neat Dev** version:

```javascript
let myArr = ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']

console.log([...new Set(myArr)])

// Outputs: (7) ["h", "e", "l", "o", "w", "r", "d"]

```

## The **[Ninja Dev](https://javascript.info/ninja-code)** version:

_Because, why not add 15 lines of code and useless comments, right!?_

```javascript
let u = [], a = ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']

for(z in a) {
  let t = false

  // Because a for loop is always better than Array.includes()
  for(g in u) {
    // Ninjas reap maximum benefit from IF statements
    if(a[z] === u[g]) // Readability matters
      t = true
  }

  // See? The more IFs, the better
  if(!t)
    u.push(j)
}

console.log(u)

// Outputs: the same, but a little more tired of typing
```
How large is the dev.to production database 🤔
Tags: watercooler, hacktoberfest, discuss
Published: 2019-10-08 13:46:09

---
title: How large is the dev.to production database 🤔
published: true
description: I'm curious how large the dev.to database is right now
tags: watercooler, hacktoberfest, discuss
---
This month of October as we do the [hacktoberfest](https://hacktoberfest.digitalocean.com) I personally adopted the dev.to project.

Browsing though the codebase, I'm loving the way the code looks so organised and simple and the [people and bots 😅](https://github.com/thepracticaldev/dev.to/graphs/contributors) who were involved in the code certainly make it seam easy, which is very encouraging.

Now I have this burning curiosity nagging me in the back of my mind
> How large is the dev.to production database? 100GB? 500GB? 2TB 😲?

Let's try guessing the size and let @ben and the @devteam tell us the answer in the end.

My guess is ≃ 250GB

---

Cheers 🥂
[@kudapara](https://twitter.com/kudapara)
How I structure my CSS
Tags: css
Published: 2019-10-08 13:05:24

---
title: How I structure my CSS
published: true
description: Having a structure for your css is fundamental so you can easily find and amend going forward, these are my tips.
tags: css
---

I am a "clean freak" and this goes for my code, everything has it's place, all of my css is built off a foundation which I then layer. This allows me to know where everything is when I need it or I need to show someone else how to amend my code.

I use SASS/SCSS, I am a relative newbie to it after being pushed by a work colleague but it's made my code much easier to manage, I now realise I was an idiot for not embracing it a long time ago.

### Folders

My folder structure is quite simple, my scss folder has 3 folders and 1 scss file, each additional scss file I create would go into one of these folders.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/dr0clzpz8ii6ncw86rfq.png)

Abstracts holds the pre-design CSS such as @font-face, body styling, mixins and variables. 

Components holds the CSS which builds elements of the design such as header, footer etc

Layouts holds the rest of the CSS such as page styles.

My theme-styles.scss file contains the following:

    // Abstracts
    @import "abstracts/__abstracts";
    // Components
    @import "components/__components";
    // Layouts
    @import "layouts/__layouts";


### Files

I have a base set of files I use in every project, hopefully every file is explanatory.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/6rabgfdyzxfywqgmajfl.png)

I use @import to add the files from each folder to the respective template file

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/v1mf81khgq9ssspq0hjd.png)

## CSS Structure

My CSS is organised in 3 parts:

1: the classes are in order of how they appear in the html
2: the css statements are ordered in alphabetical order
3: media queries are at the bottom of the file (while following the above rules)

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/tfvaf59kedbzxw384bm3.png)

Hopefully the above has given you some ideas on how to improve your project structures.
Improved Connection Pooling & Thread safety in ODBC Drivers 
Tags: odbc, connectivity, database
Published: 2019-10-08 13:42:35

---
title: Improved Connection Pooling & Thread safety in ODBC Drivers 
published: true
description: Devart introduced a large update of ODBC Drivers. Thread safety, improved compatibility with sandboxed applications for macOS, and enhanced connection pooling — these and other enhancements are already available to users.
tags: ODBC, connectivity, database
---
*Devart introduced a large update of ODBC Drivers. Thread safety, improved compatibility with sandboxed applications for macOS, and enhanced connection pooling — these and other enhancements are already available to users.*

Devart, a recognized vendor of connectivity solutions for various databases and cloud services, released updated [ODBC drivers](). Among new features and enhancements — thread safety, improved connection pooling, compatibility with sandboxed applications for macOS, and many more.

Thread safety is provided in ODBC drivers for ASE, MySQL, Oracle, SQL Azure, SQLite, and SQL Server. Now they manipulate shared data structures in a manner that ensures that multiple threads behave properly and are executed concurrently without unintended interaction.

Performance of obtaining metadata is vastly improved in ODBC drivers for cloud applications: Zoho CRM, Salesforce, QuickBooks, and others. 

Connection pooling is enhanced in all ODBC drivers. Reusing previously created connections from cache eliminates the need to create new connections, which results in significantly higher performance of executing commands on a database.

Other updates also include:
- Improved compatibility with sandboxed applications for macOS
- InterBase driver got better compatibility with InterBase 6.x, 7.0
- MailChimp driver now supports the MailChimp API 3.0
- Token-based authentication was supported in NetSuite driver
- Oracle 19c database and client were supported in ODBC driver for Oracle
- PostgreSQL driver now supports Amazon RDS for PostgreSQL
- The Direct mode in SQLite driver is now based on the version 3.27.2 of the SQLite engine

**About Devart**

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.
For additional information about Devart, visit https://www.devart.com/.
Hacktoberfest 2019: four PRs to Parcel
Tags: hacktoberfest, parcel
Published: 2019-10-08 13:04:42

---
title: Hacktoberfest 2019: four PRs to Parcel
cover_image: https://thepracticaldev.s3.amazonaws.com/i/k6zvcuc0sxq87hyrbi77.png
published: true
description: Quick memo of how I completed the Hacktoberfest challenge while contributing to a very popular project
tags: hacktoberfest, parcel
---

So here it goes — four PRs submitted for this year's challenge!

It took me several days to find issues of the right size, debug them down, and submit the solutions, but it was worth it. :) 

Honestly, every PR here is quite small, but I'm still satisfied with the impact.

1. [Add script href as a viable attribute for dependency detection](https://github.com/parcel-bundler/parcel/pull/3608)
2. [CONTRIBUTING.md: add a snippet re: how to run the dev version](https://github.com/parcel-bundler/parcel/pull/3610)
3. [Purge dist dirs before bundling](https://github.com/parcel-bundler/parcel/pull/3616)
4. [Fix: set pragmafrag for jsx in v2](https://github.com/parcel-bundler/parcel/pull/3617)
My first Full Stack Developer Job
Tags: career, selfimprovement
Published: 2019-10-08 13:02:30

---
title: My first Full Stack Developer Job
published: true
description: After 1 year of struggling i finally got my first job in the industry!
tags: Career, self-improvement
---
<p>Hello everyone!</p>

<p>I just wanted to share that after one year of struggling to get a job as a developer I finally did it!</p>

<p>I aimed for front end development but ended up as a full stack and I am really happy!</p>

<p>happiness aside, I feel scared after my first day at work.</p>

<p>I've learned a lot already but I am starting to feel a bit out of place and like quitting...</p>

<p>I shouldn't have said that but I feel like giving up. It seems that I do not have what it takes and that web development might not be for me after all...</p>

<p>I am feeling a bit down because of this but I am trying to hold on and not to give up...</p>

<p>Thanks for hearing me out!</p>
Hacktoberfest 2019 🏆🎖🏅🥇
Tags: hacktoberfest, opensource, discuss, javascript
Published: 2019-10-08 12:47:12

**Bravo!**

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1xkat3d0f109jec775td.png)

I have completed the hacktoberfest challenge who else have?
Learning JavaScript on Codecademy
Tags: beginners, codenewbie, javascript, womenintech
Published: 2019-10-08 12:29:12


**Here is a list of things I learned/googled that I don’t want to forget:**


<li>An instance is an object that has been created and exists in memory

<li>Operators are symbols that are used to perform operations

<li>Methods are actions that you can perform

<li>Codeacademy uses ‘append’ a lot, which I never say. Googled it to check…means add onto the end!

<li>You can find properties and methods of different objects in the JavaScript documentation e.g. the Math object https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math 

<li>Generate a random number between 0–100
```javascript
console.log(Math.random() *100); 
```
<li>…and then round it to the nearest whole
```javascript
console.log(Math.floor(Math.random() *100));
```
<li>I used the documentation to find this next bit, woo!
```javascript
console.log(Math.ceil(43.8));
```
<li>This returns the smallest integer greater than or equal to a decimal num.

<li>You can write single line comments with //blah blah 

<li>You can write multiple line comments with /* blah blah 
blah blah
blah blah */ 

<li>There are 7 fundamental data types in JavaScript: strings, numbers, booleans, null, undefined, symbol, and object. 

<li>All the details from the Intro to JavaScript module can be found here https://www.codecademy.com/learn/introduction-to-javascript/modules/learn-javascript-introduction/reference 

*Originally posted this on medium.*
[Capybara] like shared_examples
Tags: rails
Published: 2019-10-08 12:20:40

---
title: [Capybara] like shared_examples
tags: rails
published: true
---

## 🤔 Situation
It's difficult to read `to` and `not_to`. This makes human mistakes.

```ruby
scenario 'Each panel should be isolated open/close ' do
  visit hoge_path(hoge_params)
  within('div.section-fugas') do
    expect(find('div.section-fuga:nth-child(1)')).to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(2)')).to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(3)')).not_to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(4)')).not_to have_selector('div.section-fuga-body')
    find('div.section-fuga:nth-child(1)').find('a.section-fuga-a').click
    expect(find('div.section-fuga:nth-child(1)')).not_to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(2)')).to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(3)')).not_to have_selector('div.section-fuga-body')
    expect(find('div.section-fuga:nth-child(4)')).not_to have_selector('div.section-fuga-body')
  end
end
```

## 👍 Solution
- PORO, we have the def.
- Plus, we get more flexibility by `send(method, args)`.
- Then, we can concentrate to judge the true/false.

```ruby
def visibility_test(visibility_bools)
  expect(find('div.section-fuga:nth-child(1)')).send(visibility_bools[0] ? :to : :not_to, have_selector('div.section-fuga-body'))
  expect(find('div.section-fuga:nth-child(2)')).send(visibility_bools[1] ? :to : :not_to, have_selector('div.section-fuga-body'))
  expect(find('div.section-fuga:nth-child(3)')).send(visibility_bools[2] ? :to : :not_to, have_selector('div.section-fuga-body'))
  expect(find('div.section-fuga:nth-child(4)')).send(visibility_bools[3] ? :to : :not_to, have_selector('div.section-fuga-body'))
end

scenario 'Each panel should be isolated open/close ' do
  visit hoge_path(hoge_params)
  within('div.section-fugas') do
    visibility_test([true,true,false,false])
    find('div.section-fuga:nth-child(1)').find('a.section-fuga-a').click
    visibility_test([false,true,false,false])
  end
end
```

---
## 🔗 Parent Note
{% link https://dev.to/n350071/my-capybara-note-2gp3 %}
Developers Must Avoid These Web Development Trends
Tags: webdev, bootstrap
Published: 2019-10-08 12:20:04

---
title: Developers Must Avoid These Web Development Trends
published: True
description: Web development trends that must avoid by developers? Developers Must Avoid These Web Development Trends.
tags: #webdev #Bootstrap #bestofdev #Beginners
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ywy2nmmyxhq63eottqcn.png
---

What are the web development trends that must avoid by developers? Consistently, the web development industry observes new patterns. The new trends can embrangle engineers into squandering their vitality, asset, and time on untested applications and insufficient structure apparatuses. It is smarter to maintain a strategic distance from this conduct and spotlight on developing a solid center range of abilities as a web designer.

Full article source: https://www.decipherzone.com/blog-detail/web-development-trends

Progression in innovation has guaranteed that the World Wide Web is never again loaded up with simply straightforward, static website pages. Rather, innovation and web advancement have enabled clients to make significant, intuitive, and dynamic sites. Numerous references will assist a client with developing their sites inventively, and numerous references will even tell the means that they shouldn't take for a superior result. Clients may actualize the prescribed procedures, yet recognizing what not to do is as basic as realizing what to do.

In this present period, one of the essential parts of web advancement isn't to pursue each pattern in the market. It is imperative to remain focused according to web-based business apparatuses, site usefulness, and SEO rehearses, however, having a few bits of knowledge about the headings to pursue and the ones to maintain a strategic distance from is likewise urgent.

The initial step that a client can take is by keeping their site dynamic. On the off chance that the site of the business is dormant, it implies that the site is losing traffic and expanding the skip rate. Here is a portion of different things that a client must attempt to seek after.

##Be wary of the JavaScript Framework Bandwagons

Full article source: https://www.decipherzone.com/blog-detail/web-development-trends

A portion of the prevalent JavaScript accessible today are Angular, React, and Vue, yet there are many web designers who wrongly focus on these frameworks without having legitimate learning in the essential JavaScript.

A web engineer must know everything about the JavaScript at the back of their hand. There is practically zero uncertainty that learning the drifting JavaScript system will upgrade the attractiveness of the range of abilities, however, clients must have a firm comprehension of the fundamentals of JavaScript.
[RSpec] Factorybot trait, making a complex association data
Tags: rails
Published: 2019-10-08 12:04:47

---
title: [RSpec] Factorybot trait, making a complex association data
tags: rails
published: true
---

## 🤔 Situation
```ruby
class Author
  has_many :books
  has_many :title_covers, through: :book
end

class Book
  belongs_to :author
  has_many :title_covers
end

class TitleCover
  belongs_to :author
  belongs_to :book
end
```

## 👍 Solution
### preparing
```ruby
FactoryBot.define do
  factory :author, class: Author do

    trait :with_a_book_and_title_covers do
      after(:build) do |author|
        author.books << FactoryBot.build(:book, :with_title_covers)
      end
    end

  end
end

FactoryBot.define do
  factory :book, class: Book do

    trait :with_title_covers do
      after(:build) do |book|
        book.title_covers = FactoryBot.build_list(:title_cover, 2)
      end
    end

  end
end
```

Note1: `<<` for `build`, `=` for `build_list` to make the relations.
Note2: if you use `after(:create)`, don't forget to `.save`. 

### 🎉 Use it
You can easily make an array of author which has a book that has two book covers, and the author name is `n350071`.

```ruby
let(:author){ create(:author, :with_a_book_and_title_covers, name: 'n350071') }
```



## 📚 References

- [FactoryBot Traits - Qiita](https://qiita.com/ogomr/items/935da1072301ddc1aeaf#transient)
- [FactoryGirlのtransientとtraitを活用する - Qiita](https://qiita.com/joker1007/items/da63b8630351c1f3fe1d#活用の具体例)


---

## 🔗 Parent Note
{% link n350071/my-rspec-note-17ec %}
Search how to use the Factorybot form the project files
Tags: rails
Published: 2019-10-08 11:54:23

---
title: Search how to use the Factorybot form the project files
tags: rails
published: true
---

## 🤔 Situation
There is this Factory. You want to make sure how to use the variable 'world' in this project.

```ruby
factory :hello, class: Hello do
  transient do
    world { 'world' }
  end
```

## 👍 Search by Regex
Because the factory name is :hello, it should be
- create(:hello, blah blah blah, world )
- build(:hello, blah blah blah, world )

Then, the search word is should be like this.
```shell
(create\(:hello.*world)
(build\(:hello.*world)
```

---

## 🔗 Parent Note
{% link n350071/my-rspec-note-17ec %}
[RSpec] layout: false, how to test it?
Tags: rails
Published: 2019-10-08 11:44:12

---
title:  [RSpec] layout: false, how to test it?
tags: rails
published: true
---

## 🤔 Situation
```ruby
# HogeController
def show
  return render :expired, layout: false if @hoge.expired?
end
```

### Test matrix

| @hoge.expired? | view_template | layout |
| --- | --- | --- |
| true | views/hoges/expired.html.erb | - |
| false | views/hoges/show.html.erb | layouts/application.html.erb
​
## 👍 Solution
​
```ruby
# hoges_controller_spec.rb

subject { get :show, id: hoge.id }
  context 'expired' do
    let(:hoge) { create(:hoge, :expired) }
    it do
      expect(subject).to be_success
      # 🦄 write the layout: [] explicitly
      expect(subject).to render_template(template: :expired, layout: [])
    end
  end
  context 'valid' do
    let(:hoge) { create(:hoge, :valid) }
    it do
      expect(subject).to be_success
      expect(subject).to render_template(template: :show, layout: 'layouts/application')
    end
  end
```
​
## 👎 Falsenegative Testing
If you don't specify the template and layout, the render_template assert only the template.
​
#### Example
```ruby
expect(subject).to render_template(:show, 'layouts/application')
```
​
Here, @expected should be "show, layouts/application".
```ruby
[2] render_template :show, 'layouts/application'
=> #<RSpec::Rails::Matchers::RenderTemplate::RenderTemplateMatcher:0x00007ffd90dba7fc
 @expected="show",  👎
 @message="layouts/application",  👎
 @redirect_is=nil,
 @scope=#
 ```
​
​## 📚 References
- [ruby on rails - Rspec test to render no layout - Stack Overflow](https://stackoverflow.com/questions/16592551/rspec-test-to-render-no-layout)
- [Method: Spec::Rails::Matchers#render_template — Documentation for rspec-rails (1.3.4)](https://www.rubydoc.info/gems/rspec-rails/1.3.4/Spec%2FRails%2FMatchers:render_template)
​

---

## 🔗 Parent Note
{% link n350071/my-rspec-note-17ec %}
Express.js v.5: permanent alpha or what is going on?
Tags: javascript, discuss, node
Published: 2019-10-08 11:40:32

Hey DEVs! Express.js, the most popular web server framework for Node.js. The latest stable version of Express.js is `4`. But it also has an alpha version (v.5) with quite a long history. Latest release of v.5 was on 2018-10-26 (which is around a year ago from now). And then, if you look at the [release history](https://github.com/expressjs/express/blob/5.0/History.md) you can see that the first release of v.5 was done almost FIVE years ago (2014-11-06). And today it still stays in alpha (5.0.0-alpha.7).

**What are your thoughts on this? Have you used this alpha in your projects? Should we migrate to it or it will never really go stable?**

Please share your experience and ideas with the community, I'm pretty sure it will be useful for many of us! Many thanks in advance!

Some related links:
* [What's New In ExpressJS 5.0](https://scotch.io/tutorials/whats-new-in-expressjs-5-0)
* [Moving to Express 5](https://expressjs.com/en/guide/migrating-5.html)
Sequalize model validation or express-validator?
Tags: discuss, node, orm
Published: 2019-10-08 11:38:50

---
title: Sequalize model validation or express-validator?
published: true
tags: discuss, node, orm
---

Hey,

I am writing an api with Sequelize for the first time. I am stuck on thinking what the best way is to validate body parameters. On one hand, Sequelize provides pretty extensive model validation but I need to attempt to save the model in order to get validation error, which seems slower and less performant than if I validated the body as the first thing in my route handler with package such as express-validator e.g. Have anyone got any opinions of that?