teleren/devto huggingface dataset:
I'm planning to ditch my MacBook and move away from laptop computing
Tags: workstations, lifestyle
Published: 2018-08-31 14:21:57

---
title: I'm planning to ditch my MacBook and move away from laptop computing
published: true
description: Frustrations with my MacBook Pro are leading me to re-evaluate my machine strategy.
tags: workstations, lifestyle
cover_image: https://cl.ly/a02ad9f194df/Image%202018-08-31%20at%2010.17.28%20AM.png
---

Frustrations with my MacBook Pro are leading me to re-evaluate my machine strategy. I've been hung up on this since before I bought this computer, but my experiences have sealed the deal. What are those frustrating experiences you might ask? Basically everything. And I just don't see any laptop computers on the market that make me want to stick with this form-factor even if I simply ditched the Apple ecosystem. Mobile computing has progressed to the point where I feel adequately plugged in on the go. But ideally, I'm unplugged when I'm not at my workstation anyway.

My current workflow is that I carry my MacBook around and then plug in when I need it. The process of plugging in is itself chaotic and annoying with my various cords (and dongles!!).

I've enjoyed the convenience of one machine so everything is configured and installed as I need it, but a more cloud-centric workflow is perfectly reasonable. I look forward to finding ways to keep things in sync.

I'm no longer a fan of "working from coffee shops". It was fun for a while, but I now find it frustrating. This is likely because I lead a team and workflow disruptions just make the whole process worse.

I work both from the office and at home, which is why I have gone with the laptop, but I look forward to having two distinct physical machines and not having to carry the laptop around!

I am excited about the change. I'll keep a lower-powered laptop around here and there, and maybe see where the tablet computing scene is going in terms of secondary machines. I'm rarely all that productive with my coding work when I'm away at conferences or something, so I don't really _need_ the primary laptop for anything. I am still not sure whether I want to go MacOS, Linux or Windows.
Building a folder-based gallery for Hugo
Tags: hugo, gallery
Published: 2018-08-30 05:58:22

---
title: "Building a folder-based gallery for Hugo"
published: true
description: 
tags: Hugo, Gallery
canonical_url: https://greekdeveloper.com/post/2018/2018-08-29-hugo-gallery-shortcode
---

A custom hugo shortcode that builds an image gallery from images inside a folder


## Source Code

Image Discovery & Gallery Layout

```html

    <!-- "site root"\layouts\shortcodes\foldergallery.html -->

    <style>
        div.gallery {
            display: flex;
            flex-wrap: wrap;
        }
        div.gallery a {
            flex-grow: 1;
            object-fit: cover;
            margin: 2px;
            display: flex;
        }

        div.gallery a img {            
            height: 200px;
            object-fit: cover;
            flex-grow: 1;
        }

    </style>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.0/jquery.fancybox.min.css" />
    
    <div class="gallery">
        {{ $path := print "content\\" .Page.Dir (.Get "src") }}
        {{ $url  := print .Page.URL (.Get "src") }}
        {{ range (readDir $path)  }}            
            {{ $src := print $url "/" .Name }}                
            <a data-fancybox="gallery" href="{{ $src }}">
                <img src="{{ $src }}">  <br/>            
            </a>
        {{ end }}
    </div>

```



Fancy Box

```html

<!--
1. Replace theme's jquery with 3.3.1 version
2. Add the fancybox3 script
-->
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.4.0/jquery.fancybox.min.js"></script>

```

## Usage

```
  { {< foldergallery src="imgs" >} }
```

Will create an image gallery with the images in the imgs folder

## Sample
![](https://thepracticaldev.s3.amazonaws.com/i/9ctf6sxaksoxvb94e8vr.jpg)


Originally posted at [greek developer](https://greekdeveloper.com/post/2018/2018-08-29-hugo-gallery-shortcode)
Yarn global package install location
Tags: node, yarn, npm
Published: 2018-08-31 12:25:51

---
title: Yarn global package install location
published: true
description: Where to find the globally installed yarn packages
tags: #node #yarn #npm
cover_image: https://thepracticaldev.s3.amazonaws.com/i/dppw5qdevvc7u34sz5ar.jpg
---

## Commands

### Install a package globally
```
yarn global add ladon
npm install -g ladon
```

### update a package

```
npm update ladon --global
yarn global upgrade ladon
```

## Yarn global install locations
- Windows `%LOCALAPPDATA%\Yarn\config\global` for example: `C:\Users\username\AppData\Local\Yarn\config\global`
- OSX and non-root Linux `~/.config/yarn/global`
- Linux if logged in as root `/usr/local/share/.config/yarn/global`

also don't forget to add the yarn bin folder to your path: 

for example:
```
C:\Users\username\AppData\Local\Yarn\bin
```


## Links

- https://github.com/yarnpkg/yarn/issues/2049
- https://yarnpkg.com/en/docs/cli/global
- cover image by susannp4 / Susann Mielke https://pixabay.com/en/cat-young-animal-curious-wildcat-2083492/
How 2 TypeScript: Serious business with TypeScript's infer keyword.
Tags: typescript, webdev, functional, how2ts
Published: 2018-08-31 11:53:04

---
title: How 2 TypeScript: Serious business with TypeScript's infer keyword.
published: true
description: Warning, the contents of this post are so advanced, they're almost entirely pointless, and may be detrimental to human health.
tags: typescript,webdev,functional,how2ts
---

Hey you!  Do you want to get the return type of a function and use it, without knowing what it really is, or asking the user of your thing to supply it outright?

Of course you do.

```typescript
type GetReturnType<original extends Function> = 
  original extends (...x: any[]) => infer returnType ? returnType : never
```

Conditional types in typescript allow you to introduce type variables into the expression in a rather dynamic way.  Notice the `infer` keyword.  That says to TypeScript: "I want to take whatever TypeScript infers to be at this position and assign it to the name `returnType`".  It just so happens that the thing at that position is the return type of a given function, that we have called `original`.

What happens when you put it into action?  I AM SO GLAD YOU ASKED!  Take this extremely powerful, useful, and all-round fantasmical Higher Order Function

```typescript
const someRandomStuff = <fn extends Function>(originalFn: fn) => {
  const result: GetReturnType<fn> = originalFn(12345);

  return result;
}
```

The type of `result` is going to be whatever the return type of `originalFn(12345)` is.  We don't actually know, until...

```typescript
const innerFn = (item: number) => item.toString();
```

FYI, TS will infer the output of `innerFn` to be a string.  Then...

```typescript
const output = someRandomStuff(innerFn); // ALL SYSTEMS GO
```

Would you like to play a game?  What is the type of `output`?  The answer is: What is the type of `innerFn`?

It's a string!

If it weren't for this trick, the type of `output` would be `any`.  I know, I was surprised too.  But it's true.

You can do the same sort of thing with anything that TypeScript can infer.  Wanna get the type of arguments?

```typescript
type NYET = never // preparation for unfunny joke
type GetArgumentType<original extends Function> =
  original extends (...x: infer argumentsType) => any ? argumentsType : NYET
```

That's all, see you next time.
What's the best way to create authentication for a single-user Node.js app?
Tags: discuss
Published: 2018-08-31 10:28:50

---
title: What's the best way to create authentication for a single-user Node.js app?
published: true
tags: discuss
---

My app is not going to have more than one user.

Idea: when the app first loads, if it's the first time ever it will create a token and send it to the client (JWT?). It sets `initialized` to true in its config file.

Then the client will use that token. No other client can connect.

If the client loses the token, nothing can be done except setting `initialized` back to `false` in the app config file.

Any other strategy you'd use?
How to Fork and contribute to a Github repo
Tags: git
Published: 2018-08-31 10:25:59

---
title: How to Fork and contribute to a Github repo
published: true
description: How to work with a forked Github repo
tags: Git
---

Found a cool project on Github you would like to contribute to? Here’s how to fork the repo, keep it up to date and make a pull request.

**FORK THE REPO**

Click 'Fork' in the original repo

![Fork](https://thepracticaldev.s3.amazonaws.com/i/vlfy5pq38pnfle4q0xq2.png
)

This will create a forked version in your own Github account so you have your own copy of the repo.

**CLONE THE FORKED REPO**

1) In your forked repo, click the Clone or download button

![Clone or Download button](https://thepracticaldev.s3.amazonaws.com/i/i6pz3i5dehsgvfry4wpr.png)

2) Copy the git address

3) In terminal, navigate to a folder you want to save the repo then enter git clone followed by the copied git address and hit enter

```

$ git clone <your-repo-address>

```

You now have a local version of your forked repo.

**KEEP YOUR FORK UP TO DATE**

You can work on your forked version of the project completely separately from the original, but if you want to keep your version up to date then you need to link yours to the original by adding it as an `upstream`.

Set up (only need to do once):

1) In the original repo, click on Clone or download and copy the original repo address

2) In terminal, cd into your project folder

3) Type `git remote add upstream`, paste in the original repo address and hit Enter

```
$ git remote add upstream <original-repo-address>

```
Update:

1) To update the upstream branches:

```
$ git fetch upstream

```
This fetches all the changes made in the original repo.

2) Update your local master:

```
$ git pull upstream master

```
This pulls the upstream changes into your local master branch.

3) Then git push to your remote repo

```
$ git push

```
This updates your forked remote repo with the changes.

**SUBMIT A PULL REQUEST**

Once you have made changes to your fork, you can request for those changes to be merged into the original project.

1) Click on New pull request

![New pull request](https://thepracticaldev.s3.amazonaws.com/i/whboatvqlzz0nnjizn9d.png)

2) On the compare changes page, check the base fork is the original repo and the head fork is your repo with the correct branch selected

3) Add a title and description

4) Allow edits from maintainers will be checked. If you're not happy with this then de-select

5) Click Create pull request

Then it's up to the maintainers of the original repo to ask questions, request changes or merge it in! 🤞🏼

*This article was first published on my blog here:* 
https://ceri-anne.co.uk/working-with-a-forked-git-repo
Running on the edge analysis
Tags: showdev, discuss, overview
Published: 2018-08-28 23:25:22

---
title: Running on the edge analysis
published: true
description: what went right, what went wrong, and why deployments get easier
tags: showdev,discuss,overview
---

Following up to [my last post](https://dev.to/michaelgv/what-are-your-thoughts-on-running-code-at-the-edge-4kp8), we plunged and have been running a beta on the edge, here’s how we did it:

We started deploying edge servers, our biggest issue was concerning data sync, we wanted to have a system where the edge users could interact, post data without losing it. We use a proprietary tool to keep us in sync, but our first prototype of said tool was SQLite with no rowids, and redis to queue messages - each edge node had this running and we used this as a source of truth. The edge would POST every half hour to the backend server, we’d obtain rowids, and sync our database back in line with the master.

It worked, but we hit a big huccup: our master was assigning rowids that conflicted with edges; this was overcame by dropping our reliance on rowids all together, and using a new unique token (UUID), formatted similar to: EDGENODE-LOC-NNLL-{rand x 8}-{DMYHIS}, it worked well, and helps reduce conflicts.

We next wanted to solve the issue of pretty URL addresses, we opted to create unique slugs based on some attribute (ie: section-title-NNLL), this gave us URLs like: /admin/content-editor/page/example-page-43ax

Finally, keeping all our edges in sync: we opted for a non-standard strategy of:

Masters can PUSH and PULL

Nodes (host machine) can PUSH and PULL, restricted to a list of trusted nodes, and key authentication only

Edges can PULL but cannot PUSH except to other edges in that “farm” of servers

## Latency

For our beta users, we dropped our average response time from 230ms to 43ms - a massive improvement, and our customers who rely on the speed are thankful for it

## Negative feedback

Like all products, we got a handful of negative feedback, the biggest was our delivery cycle to keep edges updated. We try heavily on LXD, Docker and Kubernetes. We had kept Kubernetes for our caching edge, and went straight to docker and lxd for delivering the application.

We decided to deploy Kubernetes and *configure rolling updates*, and made our release cycle smooth - there was some quirks in configuring - but that’s for another post!

*P.s. we’ll post weekly updates on the edge here on Dev*
How do you stop the desire to learn too much?
Tags: discuss
Published: 2018-08-31 09:44:17

---
title: How do you stop the desire to learn too much?
published: true
tags: discuss
---

Example: While you are learning a specific thing ( language, framework, new tech ...) you read articles about a lot of stuff and when you come across a good article about a specific subject, you mind automatically wanna learn more about it so you began looking for it, and especially when you are in the step where you are struggling in your current subject, so you end up continuing looking for the second one and learning until you find yourself that you forgot about the first one and you drop it, and it may make you fall in an infinite loop of never end a learning.
luanch of idoras.com
Published: 2018-08-31 09:31:46

---
title: luanch of idoras.com
published: true
description: 
tags: 
---

I'm glad to announce the luanch of [rss reader](https://idoras.com), it's written with node.js.

How does idoras.com work?

First i collect many website's feed source, and collect feed item, then use readability api to clean the item's content, and show the content on website.
Get your end-to-end pipeline ready before coding any features
Tags: webdev, devops
Published: 2018-08-31 09:20:34

---
title: Get your end-to-end pipeline ready before coding any features
published: true
description: When you get a great idea, the next thing is to start building your MVP. But you should ship a "Hello World" to production instead of coding features.
tags: webdev, devops
canonical_url: https://blog.squadlytics.com/get-your-end-to-end-pipeline-ready-before-coding-any-features/
cover_image: https://blog.squadlytics.com/content/images/2018/08/Artboard-2.png
---

When you get a great idea (and after it's been validated), the next thing is to start building your MVP. But instead of implementing any of the required features, it's best to begin by shipping a "Hello World" to production.

## Late deployment pipelines are costly

A lot of teams have adopted Continuous Integration because it allows them to move faster. By integrating the work of everyone early and often into the mainline, you reduce the risk of conflicts and you make it trivial to understand what is breaking.

The same thinking needs to be applied to deployments. Every week you're going to be solving small configuration problems. Missing dependencies, env variables, service configuration, monitoring tools... As you add more features to your software, you will also increase the amount of configuration required for it to work. If you wait until you're satisfied with your local tests to release your app then you're likely to spend a significant amount of time figuring out how to set things up in a public environment.

The better approach is to start with your classic "Hello World" and to ship that in what will be your production. It doesn't matter if it's on mobile, desktop, web. Just make sure that you know how to deploy what you're building. And then deploy your work early and often, every day if you can.

You will drastically reduce the risk of releasing and, while it looks like slowing down at the beginning, it will make you move faster. Some platforms have hard constraints on what you can ship, and you want to figure that out right from the start instead of having to refactor your code down the line.

## Ship early, get more feedback

Now here comes the real benefit. We tend to vastly overestimate how finished our work has to be before we can show it to others. So we keep adding features after features. And then at some point, we judge it ready and put it somewhere where others can play with it.

Having your application being accessible early will help a lot to fight that tendency. Of course, it's best to keep things private until you can safely onboard people, and there are many ways to do it:

* Private URLs
* Password protection
* Unlist your app on marketplaces

But the point is that you want to be able to pull out your phone or your laptop at any moment and show what you're working on. The more feedback we get, the better we can make our products. And this is also a great way to get early adopters.
Use micro-projects to keep development fun and test your skills
Tags: showdev, css, discuss, beginners
Published: 2018-08-31 07:14:55

---
title: Use micro-projects to keep development fun and test your skills
published: true
description: Practice projects don't always need to be serious. Use micro-projects to test your front-end skills in a new way and keep dev work fun
tags: showdev, css, discuss, beginners
---

When practicing our HTML and CSS skills, it is common to either just keep learning on the job or take courses that include building out medium-to-large scale projects.

However, a valuable use of time can be to build micro-projects that test your skills and provide fun little side-experiments.

These projects could be absolutely anything. They could be as silly or as serious as you like. Personally, I love looking through [Dribbble](https://dribbble.com/) to find design inspiration.

Below, you can see a Pen I created yesterday morning over a cup of coffee, [inspired by Gis1on’s shot](https://dribbble.com/shots/4212358-YOU-CANNOT-STOP):

{% codepen https://codepen.io/stooderrr/pen/yxVoza %}

Have you done any micro-projects lately? If so, I’d love to see them!
Best Practice / Standard for API calls 
Tags: help
Published: 2018-08-31 07:07:32

---
title: Best Practice / Standard for API calls 
published: true
tags: help
---


Good day all,

I've been brain storming an issue I have and thought maybe someone could point out the best practice for my situation.

I have build a .Net Core 2 Restful API. Its still being pieced together but I am running into a 'issue' which I am not sure of which is the best solution.

When calling my https://apiURL.com/AddressBook

I then can sent through an array of parameters from

PageSize
PageNumber
SearchFor & SearchBy ( these go hand in hand as its the field to search by what value but will have a default ) 

EG: https://apiURL.com/AddressBook?pageNumber=1&Pagesize=500

I am extending this list

OrderBy

Filterfor & FilterBy


The problem is I don't know how to add these to the URL as well, as you can order by more then one column at once, as well as add multiple filters.


Would anyone have some suggestions?
Friday Blast #51
Tags: fridayblast, links, post
Published: 2019-01-20 15:26:40

---
title: Friday Blast #51
published: true
tags: friday_blast,links,post
canonical_url: https://horia141.com/friday-blast-51.html
series: "Friday Blast"
---

[In defence of complicated measurement systems (2018)](https://www.johndcook.com/blog/2018/08/25/complicated-measurement/) - a really good one from John D Cook. Measurement systems are tools for humans to use - they’re as good as is needed. We have (almost) uniform and concentrated systems now, but in the past the unit for measuring nautical distance was different from the one used to measure lengths of cloth. And why not? When would one interact with both during a regular lifetime?

[How SendGrid scales its email delivery systems (2018)](https://www.infoq.com/news/2018/07/sendgrid-email-scaling) - I was actually expecting some super advanced stuff here, considering the actual scale they deal with (40B messages per month). But there’s actually a lot of low-tech stuff (in a bad way this time - Ceph for example), and a lot of technical debt to be paid. Glad to see a nice usage of Docker in testing though.

[Where Vim came from (2018)](https://twobithistory.org/2018/08/05/where-vim-came-from.html) - Vim has a very long history, and two bit history did a bang up job of documenting it. There’s a warm and fuzzy feeling knowing that the two text editors - Vim and Emacs[1] have been worked on by some of the biggest names in computing - Ken Thompson, Dennis Ritchie, Bill Joy, Richard Stallman etc.

[M3: Uber’s open source, large scale metrics platform for Prometheus (2018)](https://eng.uber.com/m3/) - there aren’t that many _large scale metrics platforms_ to boot. Prometheus or OpenTSDB can only get you so far, but if you want to do something company wide (when the company is fairly large), and offer it as a service to other teams (so you’re not left running your own stuff and the metrics system as well, like in the 2015s), there’s not too much to choose from. The paper goes into the meat of how the system is build atop Prometheus, Etcd and others. Issues like retention polices and downsampling are also covered, which is a bit of a sore spot with the baseline components usually.

* * *

[1] And are there any others?
你好，世界！
Tags: tech
Published: 2018-08-31 06:55:27

---
title: 你好，世界！
published: true
description: 没有 
tags: Tech
---
##你好，世界！
第一篇文章！
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/d5isi94ecc4zniv4xzmv.png)