teleren/devto huggingface dataset:
A Geoloc website for a friend
Tags: javascript
Published: 2019-03-19 08:56:14

---
title: A Geoloc website for a friend
published: true
description: I was asked to retrace a thief with only their Facebook profile
tags: Javascript
---

Let's start with the beginning, a friend in Ecuador got her wallet stolen, and I only knew his name.

So I started googling him a bit, found his Facebook and of course created a fake account that seems a minimum legit.
While waiting let's figure out how I can retrieve his localisation.

Remember that in some countries what I'm going to do next don't work. I tested it with my friend and the localisation gave me her exact coordinates, while in Belgium for example it gives me a location 100 km away.

I found a pretty cool Json API that allows me to get the localisation data that is linked with the ip that is used to do the request : http://gd.geobytes.com 
So with a simple fetch it was really easy to get the information if someone opened my website.
Now the problem is a bit tricky, since it's a static page and I don't want to install a node-js back-end, just upload the files to a server host and done, so I decided to email the information to myself.

After a little bit of research, I found PostMail https://postmail.invotes.com/ , and it worked great.

Tried it myself and I can easily get the information in my mailbox of anyone who visits this page.

GITHUB REPO : https://github.com/titivermeesch/geoloc-website

There is just one downside, someone can simply extract the token I use to send the mails and use it for himself, but yeah, that's the risk I take to catch that thief.

Thanks for reading. Hope my first article is interesting.
Accessibility is a myth
Tags: devjournal, rant, ux
Published: 2019-03-19 07:55:33

I'm sitting on the bus again, pre coffee having had a terrible nights sleep, my little one's gums are giving him the run around. I'm ready to rant at something that makes me mad.

Users are users regardless of where they come from and how they access content. I see stories tacked with the label "accessibility" and this really gets to me mad. You see accessibility is just good UX, it benefits everyone and an "accessible website" is another word for well designed planned and thought out user journey.

Just design the website to include all your users and stop treating accessibility as a special subject, it's not, it's broad but it slots neatly into html best practice because it is. Unfortunately me using words like "slots in" and "it is" counters my argument but I'm reaching out to the opposite point of view.

I also believe that accessibility ratings are just a way to force developers and companies to aim for a level of UX, everyone loves goals, but how anti agile is that?

The way we view UX is broken, start a project include aria as a styling mechanic for UI state: `.dropdown[aria-hidden]` and your winning already, free and good UX, semantic attribute, less code.

End rant.
[FIXED] fatal: this operation must be run in a work tree
Tags: github, errors
Published: 2019-03-19 07:23:33

---
title: [FIXED] fatal: this operation must be run in a work tree
published: true
description: How to avoid this error
tags: github, error
---
This error may happened due to the mis-configuration of the git as `bare`. So, the following command will remove/unset the bare setup

```shell
git config --unset core.bare
```
QASH Review: Introduction To QASH
Tags: bitcoinnewstoday, cryptocurrencynews, latestbitcoinnews
Published: 2019-03-19 06:07:37

---
title: QASH Review: Introduction To QASH
published: true
description: Coinjoker News is one of the leading news websites which gives the latest technology updates and accurate cryptocoin prices. Get daily digital currency news such  Bitcoin news, Litecoin news, ripple coin news, Ethereum news, Cardano news, dogecoin news, Tron news. You can get clear knowledge and know the importance of cryptocurrencies.
tags: bitcoin news today , cryptocurrency news  , latest bitcoin news 
---

Quoine Liquid, the platform developed by Mike Kayamori and Mario Gomez in 2014, became widely known in 2017 when it became the first cryptocurrency company to be officially licensed by the FSA, Japan’s Financial Services Agency.

In this review, we will be focusing on QASH (pronounced “cash”), the native currency of the platform above. QASH is the primary weapon with which Quoine Liquid aims to solve the liquidity problems that currently seem to be plaguing the crypto industry.

How does the Quoine Liquid platform work?
To take on this monumentally ambitious goal, Quoine Liquid combines two smartly designed mechanisms/offerings: World Book and Prime Brokerage.
World Book
In short, the World Book smootfhly combines order books from different exchanges to one big order book with added fiat-pairs. This provides traders from all corners of the world with the possibility of using a great number of fiat currencies to purchase or sell crypto.

World Book consists out of a matching engine (ME), a cross-currency conversion engine (CCCE), and a smart order routing system (SOR). The ME has the ability to process millions of transactions per second, and it includes support for the major token pairings. It’s designed from the ground up to offer enough scaling power to encompass all new pairings.

The CCCE ensures automated and quick conversions between multiple currencies. It is also designed to ensure an increase in the number of possible matches. Finally, the SRO component is responsible for monitoring all major exchanges and externally competing for orders that can’t be fiddled by default by from the World Book.

Prime Brokerage
The job of the Prime Brokerage component is to provide users with direct access to all exchanges in the World Book without them having to create an account for each one. With the help of Prime Brokerage, users can also extend a credit line and leverage trades.

CLick here to read more about [bitcoin news today](https://www.coinjoker.in/bitcoin-news)
John Kistler Minnesota
Tags: johnkistlerminnesota
Published: 2019-03-19 04:28:43

---
title: John Kistler Minnesota
published: true
description: About John Kistler Minnesota
tags: #johnkistlerminnesota
---

Hello! My name is John Kistler in Minneapolis Minnesota.  I am a lover of animals and old architecture.  I am currently working on restoring an old Georgian style mansion in Downtown Minneapolis.  I spend the summers in the gardens and the outside of the historic home with my dog, duck, and pigeon, and in the winters, I work on the inside with my same cadre of helpers.  Historic Preservation is my passion and I believe that future generations will judge us more by what we preserve, than by what we create.
LeetCode in Ruby: 62. Unique Paths
Tags: leetcode, ruby, dynamicprogramming
Published: 2019-03-19 03:50:00

---
title: LeetCode in Ruby: 62. Unique Paths
published: true
description: Solution + explanation for Problem 62
tags: #leetcode, #ruby, #dynamicprogramming
series: LeetCode in Ruby
---

# Backtracking

```ruby
def unique_paths(m, n)
  backtrack(0, 0, m, n)
end

def backtrack(r, c, m, n)
  if r == m - 1 && c == n - 1
    return 1
  end
  if r >= m || c >= n
    return 0
  end
  backtrack(r + 1, c, m, n) + backtrack(r, c + 1, m, n)
end
```

This is a brute force approach to solve the problem. Don't submit this solution on LeetCode because it will exceed the time limit. It traverses all the possible paths by using a technique called [backtracking](https://en.wikipedia.org/wiki/Backtracking).


# Memorization (Top-Down)

```ruby
def unique_paths(m, n)
  @cache = Array.new(m + 1) { Array.new(n + 1, -1) }
  backtrack(0, 0, m, n)
end

def backtrack(r, c, m, n)
  return 1 if r == m - 1 && c == n - 1
  return 0 if r >= m || c >= n

  @cache[r + 1][c] = backtrack(r + 1, c, m, n) if @cache[r + 1][c] == -1
  @cache[r][c + 1] = backtrack(r, c + 1, m, n) if @cache[r][c + 1] == -1
  @cache[r + 1][c] + @cache[r][c + 1]
end
```

# Memorization (Bottom-Up)

```ruby
def unique_paths(m, n)
  @cache = Array.new(m + 1) { Array.new(n + 1, 0) }
  @cache[m - 1][n] = 1
  (m - 1).downto(0).each do |r|
    (n - 1).downto(0).each do |c|
      @cache[r][c] = @cache[r + 1][c] + @cache[r][c + 1]
    end
  end
  @cache[0][0]
end
```
LeetCode in Ruby: 26. Remove Duplicates from Sorted Array
Tags: leetcode, ruby
Published: 2019-03-19 03:37:22

---
title: LeetCode in Ruby: 26. Remove Duplicates from Sorted Array
published: true
description: Solution + explanation for Problem 26
tags: #leetcode #ruby
series: LeetCode in Ruby
---

```ruby
def remove_duplicates(nums)
  nums.uniq!
  return nums.length
end
```

First, use `uniq!` to remove all the duplicates in `nums`. Then return its length.

_Time complexity_: `O(n)`

_Extra memory_: `O(1)`
LeetCode in Ruby: 56. Merge Intervals
Tags: leetcode, ruby, sorting
Published: 2019-03-19 03:34:04

---
title: LeetCode in Ruby: 56. Merge Intervals
published: true
description: Solution + explanation for Problem 56
tags: #leetcode #ruby #sorting
series: LeetCode in Ruby
---

# Sorting

```ruby
def merge(intervals)
  merged = []
  intervals.sort_by! { |interval| interval.start }

  intervals.each do |interval|
    if merged.empty? || merged.last.end < interval.start
      merged << interval
    else
      merged.last.end = interval.end if interval.end > merged.last.end
    end
  end

  return merged
end
```

First of all, we sort the `intervals` list based on the `start` value of each interval in the list. Then we iterate through the list and append the current interval to the `merged` list if:

1. The `merged` list is empty, or
1. The `last` interval doesn’t overlap with the current interval, i.e. `last.end < interval.start`.

Otherwise we should update the `end` value of the `last` interval of the `merged` list. The updated `end` value should be greater than the previous one.

_Time complexity_: `O(nlgn)`

_Extra memory_: `O(1)`
LeetCode in Ruby: 771 Jewels and Stones
Tags: leetcode, ruby, hash
Published: 2019-03-19 03:19:41

---
title: LeetCode in Ruby: 771 Jewels and Stones
published: true
description: Solution + explanation for Problem 771
tags: #leetcode #ruby #hash
series: LeetCode in Ruby
---

# 1 Line

This approach is based on Ruby’s `String#count` method. It takes the string `j` as the set of characters to count in the string `s`. This is the fastest and the simplest solution.

_Time complexity_: `O(j.length+ s.length)`

_Extra memory_: `O(1)`


# Hash

```ruby
def num_jewels_in_stones(j, s)
  stones = Hash.new 0
  s.each_char do |char|
    stones[char] += 1
  end

  sum = 0
  j.each_char do |char|
    sum += stones[char]
  end

  return sum
end
```

First, we iterate through the string `s` and create a hash called `stones` that uses the characters in `s` as keys and their occurrence as values. Then we go through each character of `j` and sum up their occurrences.

_Time complexity_: `O(j.length+ s.length)`

_Extra memory_: `O(s.length)`
LeetCode in Ruby: 387. First Unique Character in a String
Tags: leetcode, ruby, hash, twoarrays
Published: 2019-03-19 03:13:12

---
title: LeetCode in Ruby: 387. First Unique Character in a String
published: true
description: Solution + explanation for Problem 387
tags: #leetcode #ruby #hash #twoarrays
series: LeetCode in Ruby
---

# Index and RIndex

```ruby
def first_uniq_char(s)
  s.each_char.with_index do |char, i|
    if s.index(char) == s.rindex(char)
      return i
    end
  end

  return -1
end
```

The `String#index` returns the index of the first occurrence and `String#rindex` returns the index of the last occurrence. If both of them return the same index while iterating through `s`, it’s the first unique character.

_Time complexity_: `O(n)`

_Extra memory_: `O(1)`

# Hash

```ruby
def first_uniq_char(s)
  return -1 if s.length == 0

  counts = Hash.new 0
  s.each_char do |char|
    counts[char] += 1
  end

  s.each_char.with_index do |char, i|
    if counts[char] == 1
      return i
    end
  end

  return -1
end
```

First of all, we create a Hash called `counts` that stores the counts of each character in `s` Then we iterate through `s` to see if there is a character with count of exactly 1. If so, return its index, otherwise return -1 instead.

_Time complexity_: `O(n)`

_Extra memory_: `O(n)`


# Two Arrays

```ruby
def first_uniq_char(s)
  counts = Array.new(26, 0)
  positions = Array.new(26, nil)
  offset = 'a'.ord

  (0...s.length).each do |index|
    char = s[index]
    pos = char.ord - offset
    counts[pos] +=1
    positions[pos] = index if positions[pos].nil?
  end

  s.each_char do |char|
    pos = char.ord - offset
    if counts[pos] == 1
      return positions[pos]
    end
  end

  return -1
end
```

This is very similar to the previous approach. Basically, we use two arrays to simulate the hash named `counts` in the _Hash_ approach.

_Time complexity_: `O(n)`

_Extra memory_: `O(n)`
When Should You Use A Web Framework?
Tags: discuss, webdev, frameworks
Published: 2019-03-19 03:07:05

---
title: When Should You Use A Web Framework?
published: true
description: 
tags: #discuss, #webdev, #frameworks
---

Starting a new web app project. Wary of bloated frameworks with a gabillion dependencies. I'm a relatively inexperienced developper and I often feel like I don't know what the heck is going on under the hood in a framework like Angular. Part of me wants to code closer to the browser API but at the same time I want to be efficient and not reinvent the wheel.

I've read many posts like this one:

{% link https://dev.to/gypsydave5/why-you-shouldnt-use-a-web-framework-3g24 %}

and if you take a look at the comment sections, you can see that most reasonable people, whether they tend to be pro-framework or not, agree that in certain cases, it does make sense to use a framework, or to not use one.

Both sides go on at length explaining the pros and cons of using, or not using, a framework. The one thing that everyone just seem to never get into is WHEN, exactly should we use / not use a framework? Where is this imaginary threshold where one passes from "framework good for my project" to "framework bad for my project"? How do YOU make that determination? Where do YOU draw the line? Let's get into specifics. Examples. Level of complexity. Scope. Team size. 

You're pro-framework but are reasonable enough to admit that sometimes it makes sense to not use one? On what kind of project would you consider ditching the framework and go vanilla / few small libraries?

You're anti-framework (looking at you @gypsydave5) but are reasonable enough to admit that sometimes it makes sense to use one? On what kind of project would you consider using a framework?

You're of the opinion that one should NEVER / ALWAYS use a framework? Please avoid commenting on this post and consider adding to the lively discussion on @gypsydave5 's post instead. :stuck_out_tongue_winking_eye:


Really interested to hear your diverse opinions.
LeetCode in Ruby: 242. Valid Anagram
Tags: leetcode, ruby, sorting
Published: 2019-03-19 03:02:49

---
title: LeetCode in Ruby: 242. Valid Anagram
published: true
description: Solution + explanation for Problem 242
tags: #leetcode #ruby #sorting
series: LeetCode in Ruby
---

# Count

```ruby
def is_anagram(s, t)
  return false unless s.length == t.length

  ('a'..'z').each do |char|
    return false unless s.count(char) == t.count(char)
  end

  true
end
```

The two strings `s` and `t` are anagrams if they have the same number of occurrences for each character. Even its time complexity is `O(n^2)`, it’s faster than the latter two approaches.

_Time complexity_: `O(n^2)`

_Extra memory_: `O(1)`

# Sort

```ruby
def is_anagram(s, t)
  return false unless s.length == t.length

  s_ary = s.split('').sort
  t_ary = t.split('').sort

  (0...s.length).each do |index|
    return false if s_ary[index] != t_ary[index]
  end

  return true
end
```

We convert the strings `s` and `t` into two arrays: `s_ary` and `t_ary`, with characters being sorted. If `s` and `t` are anagrams, then `s_ary` and `t_ary` must have the same character for each index. This is what the loop is checking.

_Time complexity_: `O(nlgn)`

_Extra memory_: `O(n)`

# Sort (A Faster Variant)

```ruby
def is_anagram(s, t)
  return false unless s.length == t.length

  s.bytes.sort! == t.bytes.sort!
end
```

This is the same as the previous one, except that we aren’t comparing characters but bytes.

_Time complexity_: `O(nlgn)`

_Extra memory_: `O(n)`
Orator has many through
Tags: masonite, orator
Published: 2019-03-19 02:19:09

---
title: Orator has many through
published: True
description: 
tags: Masonite, Orator
---

# Relationship [has-many-through](https://orator-orm.com/docs/0.9/orm.html#has-many-through)

The orator has many functions around [relationships](https://orator-orm.com/docs/0.9/orm.html#relationships). In the current 

* One To One
* One To Many
* Many To Many
* Has Many Through  *<- I am writing about this*
* Polymorphic relations
* Many To Many polymorphic relations


Models are like this.

```python
#app.Country
"""Countrie Model"""

from config.database import Model
from orator.orm import has_many_through, has_many


class Country(Model):
    """Countrie Model"""
    
    __table__ = "countries"
    __fillable__ = ['name']
    from app.User import User

    @has_many("country_id", "id")
    def users(self):
        from app.User import User
        return User

    @has_many_through(User, 'country_id', 'user_id')
    def posts(self):
        from app.Post import Post
        return Post
```

```python
# app.User

"""User Model."""

from config.database import Model
from orator.orm import belongs_to_many, has_many

class User(Model):
    """User Model."""

    __fillable__ = ['name', 'email', 'password', 'country_id']

    __auth__ = 'email'

    @has_many
    def posts(self):
        from app.Post import Post
        return Post
```

```python
# app.Post
"""Post Model"""

from config.database import Model
from orator.orm import belongs_to


class Post(Model):
    """Post Model"""
    __fillable__ = ['user_id', 'title']

    @belongs_to
    def user(self):
        from app.User import User
        return User
```

![database](https://thepracticaldev.s3.amazonaws.com/i/hycqdwdns3c536fzt1jv.png)




The controller is very simple, just all()

```python
""" A testController Module """
from app.Country import Country
from masonite.view import View

class testController:

    def index(self, view: View):
        """Show several resource listings
        ex. Model.all()
            Get().route("/index", testController
        """

        countrys = Country.all()
        return view.render("index", {"countrys": countrys})
```

Now it is possible to user and post in the view.

```html
<ul>
    {% for country in countrys %}
        <li>{{ country.id }} {{ country.name }}
            <ul>
            This comes from Country.users has_many
                {% for user in country.users %}
                    <li>{{ user.name }}
                        <ul>
                            {% for post in user.posts %}
                            <li>{{ post.title }}</li>
                                {% endfor %}
                        </ul>
                    </li>
                {% endfor %}
            </ul>
            <ul>
            This comes from Country.posts has_many_through User
                {% for post in country.posts %}

                    <li>{{ post.title }} {{ post.user.name }}</li>
                {% endfor %}
            </ul>
        </li>
    {% endfor %}
</ul>

```
git cherry-pick webdev
Tags: codenewbie, pseudocodenewbie
Published: 2019-03-19 00:57:14

---
title: git cherry-pick webdev
published: true
description: 
tags: codenewbie, pseudocodenewbie
---
It’s easy enough to be tasked with a small bug, run the app locally, put breakpoints, and debug the code using Chrome Developer Tools. It’s easy enough to be assigned a small user story that adds a dropdown to a form and requires modification to the form payload, and to follow the practices set forth by the senior UI developers on the team when submitting a pull request against master for the user story. That’s what got me hooked in the first place. I love the instant gratification aspect of front-end development, and I love creating reusable components.

![Guilty as charged.](https://i.redd.it/4vgo5urck9mz.jpg)<figcaption>Guilty as charged.</figcaption>

I started with Java, an object-oriented language, unlike JavaScript, a dynamic language. Most of my college courses and projects were extensively in Java. The programming mindset I had obtained from learning Java helped tremendously at hackathons and at internships, even though they were web dev. I experimented with Telerik, a platform for hybrid app development, at my first hackathon, and to the astonishment of my team, we won first place. I worked with Angular 1.0 at my first internship, ventured into the realm of Node.js at the next one, then Polymer in my first rotation of the career accelerator program for which I work full-time, and finally, React/Redux in my second rotation. 

_Notice a common theme?_

A lot of tinkering, a lot of JavaScript frameworks, a lot of that scrappy perseverance to ship code, and a whole lot of Googling and StackOverflow. And yet, the focus on fundamentals is mysteriously absent. 

In other words... does anyone remember learning how to manually find the derivative of a polynomial using the definition of a derivative and what a pain it was? Then finding sweet salvation in the power rule? 

![Slope formula.](http://sites.psu.edu/math140/wp-content/uploads/sites/14857/2015/02/12.png)<figcaption>Having to do all this work.</figcaption>

![Power rule.](https://8d117786-a-62cb3a1a-s-sites.googlegroups.com/site/julierose3801/introductory-calculus/introductory-calculus/the-power-rule/ThePowerRule..png)<figcaption>Versus this easy quickhand way of differentiating.</figcaption>

What does that have to do with anything? Well, when you think about it, you fully understand and appreciate what you’re doing when using the power rule because the previous way was more tedious. If you had started out differentiating with the power rule, you were essentially taking a shortcut. In a similar way, I’ve consistently skipped to using the JavaScript equivalent of the power rule and hacking together solutions and as a result, I’m rusty on JavaScript fundamentals and understanding both the power and limitations of vanilla JavaScript. _Why React? Why Node? Why Vue? Why Backbone? Why Ember?_ The answer to the why can only be found in the basics. 

And back to the basics I go. 🚀