teleren/devto huggingface dataset:
Render a computer badge with name and state in markdown with PowerShell using MarkdownPS
Tags: powershell, markdownps, devops, automation
Published: 2020-04-06 20:03:17

Originally posted [here](https://sarafian.github.io/tips/2016/05/06/markdownps-badge.html)

Using [MarkdownPS](https://www.powershellgallery.com/packages/MarkdownPS/) PowerShell module this is a simple cmdlet that 

1. Tests the state of the computer using PowerShell's `Test-Connection` cmdlet
1. Depending on the outcome it generates a badge in markdown with red or green state. 

```powershell
function New-ComputerBadge {
    param (
        [Parameter(Mandatory=$true)]
        [string]
        $Computer
    )
    try
    {
        if(Test-Connection $Computer -Quiet)
        {
            $color="green"
            $status="Live"
        }
        else
        {
            $color="red"
            $status="Not Live"
        }
        New-MDImage -Subject $Computer -Status $status -Color $color
    }
    catch
    {
        Write-Error $_
        New-MDImage -Subject "Badge" -Status "Error" -Color red
    }
}
```

Example

```powershell
New-ComputerBadge -Computer "EXAMPLE"
```
renders the following markdown

~~~
![](https://img.shields.io/badge/EXAMPLE-Live-green.svg)
![](https://img.shields.io/badge/EXAMPLE-Not%20Live-red.svg)
~~~

> ![](https://img.shields.io/badge/EXAMPLE-Live-green.svg)
> ![](https://img.shields.io/badge/EXAMPLE-Not%20Live-red.svg)
Advanced TypeScript Exercises - Question 8
Tags: typescript, javascript, challenge
Published: 2020-04-06 21:40:46

--- series: Advanced TypeScript Exercises ---
Welcome back! Let's go back on track after bonus questions. This question will be less abstract, and more practical, we will land more at value level 🚁.

We have a function `concatToField` which takes object, and key of this object, and string value. The purpose of this function is to create a new object with concatenated property object[key] with third argument.

**The question** - How to type generic types `T` and `K` in the definition of `concatToField` function in order to achieve compile time guarantee that `obj[key]` can be only `string`.
```ts
const concatToField =
  <T /* here your code 💪*/, K /* here your code 💪*/>(obj: T, key: K, payload: string): T => {
    const prop = obj[key]; // compile error should not be here
    return { ...obj, [key]: prop.concat(payload) }; // compile error should not be here
}
// tests
const test = { fieldStr: 'text', fieldNum: 1, fieldStr2: 'text' };
concatToField(test, 'fieldStr', 'test'); // should be ok 👌
concatToField(test, 'fieldNum', 'test'); // should be error fieldNum is not string field 🛑
concatToField(test, 'notExistingField', 'test'); // should be error - no such field 🛑
concatToField(test, 'fieldStr2', 'test'); // should be ok 👌
```
Full code available in [the playground](https://www.typescriptlang.org/play/index.html?ssl=11&ssc=61&pln=1&pc=1#code/MYewdgzgLgBKbAIZQCogGIEsCmAbAJjALwCwAUDDADwowD0AVDABbYBO2MAniAK5twQ+ToF4NwFU7DOgBoYAaXpNWHbnwGhhMcZIB8AChAAjAFYAuGChkBrbFzOyZAB0RdcIRPjPQ2mMAHMAlGa0RNowAN7klJTw0DAObCAOxDCGRgDa1lwAugDc9HSCALYOmLic7AlskVEcUPxg4TAAdC2pMhk2WWbxiU3wSFC6Ti5u+P4wAL55dAWgxaXlbJXkE+QzMFDY0BDkMbCbsUSNAGY4BADKUGxmAOSbAB5QNzKnePgAcryFZgCML2f4S5sABMtweT0mOV24AGaCwb10BygMhurwuV2eMDuWye-mmBQgzD4BBgBk4IEsmkAMjvQhDIOEAxE4lFoj5fTHY6A3PH5GCE4mEMkwCogASsz6FGCYCAwMAgWBeHy+GCszSARb3abCMIykSi5VAAKL3aVQJXwggcpHc-F8om8ElCkUCAC0spAfN4wGYKoB6s19O1CN1WNZQOBlpx1t5-PtgvJlJENLI5CAA)

**Important** - body of the function should remain unchanged, no type assertion (as), or any changes of the body are allowed. The only thing needs to be done is constraint on `T` and `K` generic types.

Post your answers in comments (preferred links to the playground). Have fun! Answer will be published soon!

**This series will continue**. If you want to know about new exciting questions from advanced TypeScript please follow me on [dev.to](https://dev.to/macsikora) and [twitter](https://twitter.com/macsikora).
Job Search Week 7
Tags: makers
Published: 2020-04-06 22:00:31

So I decided to clean up some of my repositories from Makers this week. I thought it'd be nice to go back over the basics and also have everything looking nice.

Day 1

So on Monday, I started with Boris bikes picking up where I had left off in week 1 of makers. It was quite fun to go back and see my old code and also see how far I've come since then. I managed to get through some of the things I had been stuck on and do some of the challenges I didn't get a chance to do.

Day 2

On Tuesday, I got to do some mocks and stubs which was nice because I wanted to get some practice in using them and now I've done that it makes more sense to me.

Day 3

I got more functionality done on Wednesday. I continued working with classes although a bit repetitive I think it's good to go over the basics because a solid understanding of the basics will help when implementing more complicated functionality. I also updated the documentation on Boris bikes to make it more relevant.

Day 4

I continued to work through Boris bike adding the van and garage classes to the project. I did notice that there were some similarities between the van, garage and docking station classes which was where the module came in.

Day 5

On Friday, I just finished off Boris bikes completing the last of the functionality and updating the documentation. I also got to use a module which I didn't get to during makes which were interesting to work with.

Summary

Overall I think this was a good week I worked on the basics and got Boris bikes and the airport challenge nicely cleaned up. I think I'll keep working through the Makers projects till along with my side projects.
Curso JSON - 3. Herramientas
Tags: spanish, vscode, node, javascript
Published: 2020-04-06 23:45:45

{% youtube uE8QD3ztKUg %}

Curso sobre JSON de novato a experto (**versión GRATIS**)
Presentación: https://slides.com/equimancho/json/#/3

Repositorio:
https://github.com/equiman/playground-json

Descargas:
Git: https://git-scm.com/
Visual Studio Code: https://code.visualstudio.com/
NodeJS: https://nodejs.org/

Curso recomendado de Visual Studio Code (Fernando Herrera):
https://cursos.devtalles.com/courses/visual-studio-code

Contadores (Mr. Timer):
https://www.youtube.com/channel/UCYo5An-3L_eOd1l5WQdU3oQ

---

**That's All Folks!
Happy Coding** 🖖

[![cerveza](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4zle20oa7anpfjvap8n.png)](https://github.com/sponsors/deinacademy)
Reading Snippets [52 => CSS] 🎨
Tags: todayilearned, css, beginners, html
Published: 2020-04-07 09:40:20

Calc() can be used in CSS to perform math operations on values. 

It can be used for performing different calculations, including adding and subtracting values, using percentages. 

For example:

<code>

div {
max-width: calc(80% - 100px)
}

</code>


<kbd><small><a href="https://flaviocopes.nyc3.digitaloceanspaces.com/css-handbook/css-handbook.pdf">Flavio Copes,The CSS Handbook</a></small></kbd>
TUNS Dark Mode ON!
Published: 2020-04-07 09:47:23

here is the new DARK look of TUNS ( https://www.tunsapp.com ).


<a href="https://ibb.co/qsKZxKG"><img src="https://i.ibb.co/r6YWvYP/Screenshot-2020-04-07-at-11-46-08.png" alt="Screenshot-2020-04-07-at-11-46-08" border="0"></a>


<a href="https://ibb.co/zVc4cW5"><img src="https://i.ibb.co/TMXgXDT/Screenshot-2020-04-07-at-11-41-53.png" alt="Screenshot-2020-04-07-at-11-41-53" border="0"></a>

Enjoy!!
Working with 3D models in WebGL
Tags: javascript
Published: 2020-04-07 10:55:50

Credits: model in cover by Meeee

This is a lazy checklist for your workflow talking about the wonderful GLTF format. Your going to need JavaScript to view this stuff so its tagged with that.

I am exploring its capabilities and what workflow you or I will need in Blender to achieve the results we want. First off you wont achieve the results you want, anyone familiar with photo realism in blender will know about Cycles renderer, it's not going to look like that so lower your expectations a pinch, then do that again 5 or 6 times.

As soon as I found out about GLTF I downloaded a copy of blender and made my first model in 12 months or more, I built that lovely watch model in the cover image (I love watches!). I am not fully happy with this model because its missing a few things, but still thats not the point.

Exporting this to a GLTF file using Blenders built in GLTF exporter yielded some results with let's say... potential.


The first thing you will notice and perhaps this is not a shock, GLTF does not respect blenders modifiers which resulted in my first attempt having only quarter of the model visible, fortunately the exporter has an option to apply said modifiers without any distractive results to the original model.

The next problem, although GLTF does handle PBR materials, my glass was opaque, it looked good but not good for a watch. "Hey whats the time, IDK I have an opaque watch you moron!". I probably should use Glass BSDF shader?

Lastly performance, my model is not optimised, in-fact its so bad internally that If I where to target the web again (which I will), a lot and I mean a lot of cleanup would need to be done, I will look into this in a further article, but for the moment, 16FPS was what I got.

Anyways here is the checklist:
- Apply modifiers in export
- Dont expect lighting to work
- Materials will look more like material preview then render
- Consider if transperncy works
- Optimise mesh and clean it up, only keep what is visible, simplify what you can get away with

Whats next, GLTF animation of the hands :)
Thanks for reading.
About Me
Published: 2020-04-17 13:21:26


*Yup. Thats's me :)*


First off, I would like to introduce myself.

My name is Mariana and I am from Brazil 🇧🇷 . I have a bachelor's degree in Civil Engineering, currently finishing my specialization in Structures and Foundations. However, I always liked the power and magic that come from a computer yet never have given it a try. Along with this *ignored* desire, when I graduated there was not much room for me from where I live (*professionally-wise*)  and so I started to explore more and more about programming. Starting with data science then right after I got in touch with web development. As expected, my passion just reflourished (*pretends to be shocked*) and now I am changing careers. 

When I started to get back in touch with programming, I had the fortune to come across wonderful people from the tech industry which made a **HUGE** difference in my life. I am truly and deeply grateful for them. It led me to many good things: an internship, meet more wonderful people, getting scholarships from online courses ... It is like all started to happen (and still is ). And now I know what I want for my professional life. Like. For. Sure. I am struggling with a lot of things and concepts and I will struggle a lot more but I feel happy, rewarded and motivated with this environment.

So ...  how do I came up with the idea of this blog? 🤔 Well, I have never written a blog or anything alike but I always had the will to communicate with people and to exchange knowledge. And this blog is a good approach I found to do so (and train my English and writing haha).  I believe that when we share knowledge we both teach and learn in the best way possible (active learning). Besides, when we share our journey/perspectives/tips we enable people to resonate with us and help them in their own journey. I guarantee that having someone to push you forward and/or to look up to can have a great impact on our lives.

I hope I can support you somehow and please feel free to be in touch.

Oh,  and don't forget to get your daily coffee dose.

Now, let's code 🤓

---

Also posted on [Hashnode](https://cafecotech.hashnode.dev/about-me-ck8mj4wg601en79s1ytiu6v9h)
Developers: How do you tackle your bugs?
Tags: discuss, bugs, webdev
Published: 2020-04-17 13:55:15

---
title: Developers: How do you tackle your bugs?
published: true
description: 
tags: discuss, bugs, webdev
---

In my organization we set up a rotating Bug Stream process, to handle incoming and existing bugs. When blogging about it, I've asked myself

"How are others tackling bugs?"

So let's share how your team, organization is handling bugs.

- How are they collected?
- How are they prioritized? 
- How are you fixing them ?
Day 119 : The Whole World
Tags: hiphop, code, coding, lifelongdev
Published: 2020-04-17 22:08:49

_liner notes_:
- Professional : Had our product team meeting. It was good to hear what everyone has been up to for the week. Mostly did more research for my blog post. Had our "Happy Hour" where a few of us get to catch up. That was fun.

- Personal : Last night, I went through a few tracks for the radio show and worked on adding fill in data and styling it for the Web Component I've been working on.

![A lake surrounded by grass, forest and mountains in the background in Teton Range, Wyoming](https://dev-to-uploads.s3.amazonaws.com/i/0w8utanoj6mh02qs77d4.png)

Got my laundry washing. Going to finish up the work for the radio show and also get the Web Component up and running. This weekend, I want to get an old project working so I can use it as a base for our hackathon next week.

Side note: Does it sometimes seem like the whole world is crazy?! haha

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube udmTfK6_aM8 %}
Multilingual Magic Part 2
Tags: wordpress, bootstrap, acf
Published: 2020-04-17 22:55:39

---
series: [Bootstrap Tabs for Translations in Wordpress]
---

The previous post went over the frontend basics of a Bootstrap tab structure to display some text in three tabs, one for each translation. Now we will take a look at the Wordpress side of adding those fields for the client to enter the text. 

Using the [Advanced Custom Fields plugin](https://www.advancedcustomfields.com), I added a field group for Languages, with a field for Russian and one for Spanish. The default tab will be English so we don't need to add a field for that one since it can be the regular content. This is what the ACF field group looks like:

![Field Group of Languages](https://i.imgur.com/ONdSALw.png)


I selected a Wysiwyg Editor as the field type since this will give the client control over the text, but you could just as easily choose any other field type. This is what it will look like for the client:


![ACF WYSIWYG Example](https://i.imgur.com/qNdbr33.png)


In the previous post I included the following HTML to get the tabs working.

```HTML
<div class="tab-content" id="alertTabContent">
        <div class="tab-pane fade show active" id="english" role="tabpanel" aria-labelledby="english-tab">
            <a href="<?php echo esc_url( get_permalink($id) ); ?>">
                <h5 class="text-red alert-content"><?php  the_content(); ?></h5>
            </a>
        </div>
        <div class="tab-pane fade" id="russian" role="tabpanel" aria-labelledby="russian-tab">
            <a href="<?php echo esc_url( get_permalink($id) ); ?>">
                <h5 class="text-red alert-content"><?php the_field('russian'); ?></h5>
            </a>
        </div>
        <div class="tab-pane fade" id="spanish" role="tabpanel" aria-labelledby="spanish-tab">
            <a href="<?php echo esc_url( get_permalink($id) ); ?>">
                <h5 class="text-red alert-content"><?php the_field('spanish'); ?></h5>
            </a>
        </div>
</div>
```

Two key pieces of code here are the lines pulling in the content from those custom fields: `<?php the_field('russian'); ?>` and `<?php the_field('spanish'); ?>`. 

`the_field()` is a built in [ACF function](https://www.advancedcustomfields.com/resources/the_field/). The selectors are the field names. ACF made it so simple yet so powerful too!  

With that, you have a fully customizable set up for displaying text in three discreet tabs using Bootstrap and pulling in the content from Wordpress. After the site is live I will add the frontend design here so be sure to check back!
HTB CTF - Decode Me!!
Tags: codenewbie, security, htb, ctf
Published: 2020-04-17 23:32:06

- CTF Name: Decode Me!!
- Resource: Hack The Box CTF
- Difficulty: [30 pts] easy range

Note::: NO, I won't be posting my found FLAGS, but I will be posting the methods I used. 

<hr>




### Flag1
- Hint:  Try find the flag! 
- Acquired By: 
 - First thing to do is obviously download the file and extract the file. While a lot of people will use the command line for this I usually just to my file folders. It's easy so why not.
 - Next is to just look at it.![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/k3jzwuxrxt8lsa7mq8u6.png) At first it appears to be something that is Base64 encoded as the lines end with the usual "=" but this is not the case... yet. So first thing I did, like many others, is try to decode it like this, but it fails.
 - After a bunch of Googling and browsing the HTB fourms someone mentions a key and code so if we look into that we find the Fernet (symmetric encryption). This is a "symmetric encryption method which makes sure that the message encrypted cannot be manipulated/read without the key. It uses URL safe encoding for the keys. Fernet uses 128-bit AES in CBC mode and PKCS7 padding, with HMAC using SHA256 for authentication. The IV is created from os.random()." (1)
 -  This produced something that was less than finished but it looks like there is another string of Base64 so lets decode that now.![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6lambme1xisjfjmc2cna.png)This is still not really helpful though...
 - Now it's time for MORE Googling and HTB forums and I got a hint about "Malbolge Tools". Malbolge is "Malbolge is a public domain esoteric programming language... that was specifically designed to be almost impossible to use, via a counter-intuitive 'crazy operation', base-three arithmetic, and self-altering code." (2)
 - Once I found the Malbolge Decoding tool I was able to throw in the new output and get the flag.![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jhxpmufnf32sfw7qhaxd.png)










### Learned
This flag taught me the power of forums and getting help.
This flag was a crazy 3 step process that I would not have been able to get on my own. The input for the Malbolge Tool was something I have never seen before and don't think that I will see again outside of CTFs but I am glad I've seen it.


<hr>

Happy Hacking
![](https://media.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif)

### Resources:
1. https://asecuritysite.com/encryption/ferdecode
2. https://en.wikipedia.org/wiki/Malbolge
3. https://zb3.me/malbolge-tools/
4. https://asecuritysite.com/encryption/ferdecode


###### Please Note: that I am still learning and if something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
Command Object Pattern
Tags: oop, patterns
Published: 2020-04-18 01:00:04

How would I explain Command Object Pattern to Myself.

# What is it?
The Command Object Pattern to encapsulate what would have otherwise been a function call inside an object that is abstracted away behind an interface.

The Command Object Pattern is a pattern of four classes:
## The Command
Implements the Command Interface and takes a dependency on the receiver. The command encapsulates everything needed to call the receiver.

## The Receiver
The class being on by invoking the command.

## The Invoker
Depends on an abstract Command interface. Does not know anything about the concrete implementation of the Command.

## The Client
High level class responsible for connecting the invoker with commands.

# Why is it good?

The Command Object Pattern facilitates using the Open Closed Principle on the Invoker. Making the Invoker open for extension and closed for modification by providing behaviour at run time. This allows for independent testing of components and component reuse.

# Where would you use it ?
The Command Object Pattern's use case is any where that you have an object that needs to share some behaviour across multiple instances (possibly in multiple applications) while allowing other behaviours to be specific to an instance.
 
An example is implementing a Button class. The button knows about display and interaction logic. The behaviour that is invoked when the button is pressed is not an implementation detail of the Button class but is provided at run time. 

# N.B.
This is a pattern that I thought I understood. I actually had it confused with the Command Bus / Command Handler Pattern.
REST API Testing with Cypress( Full CRUD Example)
Tags: cypress, testing, beginners, tutorial
Published: 2020-04-18 10:34:19

In this video cypress tutorial for beginners, We are going to learn to perform REST API Testing with cypress.


[![Cypress API Testing](https://i.imgur.com/bfyEtCB.png)](https://youtu.be/3q4l3wzFiMI "Cypress API Testing")


👉 Learn Software Testing Concepts:  https://scrolltest.com
🙏 Learn Cypress Tutorial:  https://cypresstutorial.com.
👔 Learn API Testing: https://www.learnapitesting.com
👮🏻‍♀️ Automation Tester Training: https://thetestingacademy.com

--
Be sure to subscribe for more videos like this!

[![ TheTestingAcademy](https://dev-to-uploads.s3.amazonaws.com/i/r7vcy6wbvyjbk1y1uu0o.png
)](https://www.youtube.com/TheTestingAcademy?sub_confirmation=1 "TheTestingAcademy")
Efficient Software vs Software that just works
Tags: programming, coding, development, codequality
Published: 2020-04-18 12:53:46

---
title: Efficient Software vs Software that just works
published: true
description: 
tags: programming, coding, development, codequality
---

I landed on this post today.

[Link](https://dev.to/tux0r/does-your-website-really-need-to-be-larger-than-windows-95-16mm)

This is a post from 2018 and I landed on this looking for a good way to build multi platform apps while maintaining a really small footprint. The arguments and discussions in its comments were hilarious and kinda pleasing it lead me to a rust based webview for pure web apps but on a desktop. 

Anyway, was close to locking on programming the whole thing in C/C++  and use some abstractions to support all 3 platforms, and all this headache because, I realized that a lot of tools that I have installed are built with the chromium engine as a window layer with Electron on the top. A few to name would be VS Code, Postman, Spotify , WebTorrent which ended up taking a lot of space on my disk vs softwares like Sublime and Transmission that hardly take up any space and the only reason I don't use Sublime is because the packages I need are obsolete and need a little tweaking to get them to work. So I, just end up letting vscode eat my ram and battery.

For anyone else, the disk/ram/battery usage is important to me because I have a entry level Macbook Pro with just 121gb of user storage and that fills up quickly when you are a nodejs developer. Cause well, just 20 Repositories have over GB's worth of just node_modules and then I even decided to download XCode and Android Studio because someone wanted a Flutter and React Native application as well. 

I agree with @tux0r and being a fellow minimalist it would be a nice if software was efficient and more focused on being performant while being small instead of

"Yeah, this library, that lib, add all of them up and ship it, if the user needs the software he'll download the 200GB installation candidate!"

Now, @tux0r's argument was specific to websites being a huge ram hog
but in the comments he ends up supporting desktop apps for heavier tasks and most of the people end up supporting electron and JS as a language. 

Now I know its not going to be ideal for business as they want everything quick and not always *done right* but a lot of us do build projects for fun and we should actually try to build something that is a lot faster to use while not being a ram hogger. Cause , a lot of people don't upgrade for a long time and they can't really enjoy the software you built.


On a different note, I'm still unable to decide what I should be doing for that multi platform desktop app I wanted to build...