teleren/devto huggingface dataset:
jQuery Inheritance
Tags: javascript, jquery, inheritance
Published: 2020-03-23 16:47:07

Since the arrival of jQuery in 2005, client side web applications have grown substantially more dedicated to taking advantage of the newly popularized paradigm wherein javascript based interactions with the user trigger the modification of data presented on the screen.  

Today, 75% of websites on the internet are using jQuery and practically all of the most popular websites in the world are heavily reliant on Javascript to perform their functions. Inheritance has been a concept so infused with classical object oriented programming that it doesn't at first glance appear to go hand in hand purely functional javascript and the realities of client side architecture. But, Inheritance is by nature a proven characteristic of data models that are widely used and distributed to perform required tasks more efficiently and sustainably in a given environment or across networks.

Here are some example of how jQuery uses inheritance to expand its usefulness as client side manipulator of data. 

$(document).ready(function(){

function Character(name, job) {
 this.name = name;
 this.job = job;
}

Character.prototype.sayHey = function () {
 return this.name + " says hello";
};

var sean = new Character("sean", false);
sean.sayHey();

$(".test").append("<div>Hello World!</div>")
$(".tClass").css("color", "green");

 $("input").focus(function(){
   $(this).css("background-color", "cornflower-blue");
 });

});
i need the pros and cons of Google AMP
Tags: help
Published: 2020-03-23 16:08:22

---
title: i need the pros and cons of Google AMP
published: true
description: need help, someone can explain me this?
tags: #help
---

i found the amp docs in amp.dev, implemented one page using it, but i'm not sure if this is the right choice, this will be implemented in a customer ecommerce, he asked to put it because he saw this on the competitor's website. his online store is huge (he sells shoes, clotches and acessories). i need to know a reason to use it. why not just improve the mobile (responsive) site instead of use AMP?
Colt Steele's Free Code Camp
Tags: webdev, html, css, javascript
Published: 2020-03-23 16:01:22

Hello everyone! I just wanted to share with you that Colt Steele (an excellent instructor from Udemy) has just started a Free Code Camp on Youtube. 

Colt's Code Camp Day 1: https://www.youtube.com/watch?v=SF_Xl5TOGlY

Titled "Learn to Code at Home for Free", promises to be a way for anyone to enjoy learning to code during these difficult times.

If you are already a developer you might not need this, but it could be a valuable resource if you know anyone that might want to start coding.

I looked into it and it's mostly about Web Development. The first episode gives an overview of how Web Development works in general and he'll continue in the following days teaching how to work with Web Development tools and languages.

I'm not affiliated with Colt in any way, I just thought it could be nice to share it.

Have fun!
How to Learn Java
Tags: java, learnjava, studying
Published: 2020-03-23 15:58:08

---
title: How to Learn Java
published: true
date: 2020-03-23 15:49:22 UTC
tags: Java,learn java,studying
canonical_url: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/8an54wvxo6alhrjkzah9.jpg
---

I've been working on an article on my blog, Coding with Jaeheon Shim, for quite some time now. 

In this article, learn why learning Java is a good investment to yourself, and how you can learn Java effectively and retain information.

I'll cover why you should learn Java, tips for learning Java, books, videos, and websites for learning Java, and some project ideas for you to use to exercise your Java skills.

In this article:
- Why learn Java
- How to learn Java (How to stay motivated, retain information, etc.)
- Resources for learning Java (books, online courses, websites, communities)
- Project ideas for learning Java.

Check it out here! [How to Learn Java](https://jaeheonshim.com/how-to-learn-java/) on [Coding with Jaeheon Shim](https://jaeheonshim.com).
What is your Data API strategy?
Tags: discuss, webdev, csharp, dotnet
Published: 2020-03-23 15:19:13

---
title: What is your Data API strategy?
published: true
description: A discussion about how .NET client apps connect to the server for data
tags: discussion, webdev, csharp, dotnet
---
📞 calling all .NET developers!

I'm curious about your data API strategy. When you connect to data from a .NET client (Blazor, WPF, Xamarin, web application etc.), what is your preferred API strategy? 

I have a Twitter poll that is active for the next few days. If you could take a moment to answer it, that would be great. Share with your developer friends but let's have a deeper discussion here.

{% twitter 1242102559189266433 %}

Thanks. I look forward to your thoughts!
TetraQuicky04: Recover docker parameter used to run a container
Tags: docker, devops, linux, bash
Published: 2020-03-23 14:59:34

How many time you managed to run a container with exactly the parameter and the configuration you needed but you for some reason your `Ctrl+r` is not finding anymore in your history the exact flags you used... 
Damn it that was exactly what you need. I needed that so that I throw it at my Kubernetes/rancher/swarm/whatever orchestrator to finish this stuff and go home... 

Yes, you can start to `docker inspect` the hell out of a container but you don't really want that. It's late and you just want to go home. Or you don't care because you are not one of those DevOps wizards that always fix everything and you only care in getting your container up and running.

Well, this [guy](https://github.com/lavie/runlike) has exactly the solution for you!!

And I have been using it like a crazy guy because it just works:
```bash
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
    assaflavie/runlike YOUR-CONTAINER
```

then, as the author suggests, you can alias it:
```bash
alias runlike="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike"
```
so that you can easily stuff like that:
```bash
$ runlike -p redis

docker run \
    --name=redis \
    -e "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
    -e "REDIS_VERSION=2.8.9" \
    -e "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-2.8.9.tar.gz" \
    -e "REDIS_DOWNLOAD_SHA1=003ccdc175816e0a751919cf508f1318e54aac1e" \
    -p 0.0.0.0:6379:6379/tcp \
    --detach=true \
    myrepo/redis:7860c450dbee9878d5215595b390b9be8fa94c89 \
    redis-server --slaveof 172.31.17.84 6379
```

Boom!!

Job done... now I can go home (or in time of quarantine, I can just go to the kitchen to cook something).
PHP-Worker in Laradock
Tags: laravel, docker, tutorial, queue
Published: 2020-03-23 14:53:52

Laravel has queue functionality to enable the app to do asynchronous processes. If we use only laradock's `workspace` container to perform `php artisan queue:work`, you might want to open a new workspace bash session to do something else. We need something/service that runs the queue jobs in the background to make our life easier. Of course, Laradock has it and it's called `php-worker`

### Prerequisites

If you have no idea what Laradock is, then please play with it first and set up your laravel application in it by following [this](https://dev.to/dendihandian/laradock-a-php-developer-s-best-friend-33ef) guide and then try setup mailhog server, how to configure it and set up a basic artisan command to send a mail [here](https://dev.to/dendihandian/mailhog-in-laradock-1ej6). These two guides will help you (also me to cut the current post length) to get the basic needed to follow this post.

### Create a worker configuration for your project

If you follow my first post in the series about the laradock introduction, then we can use the same directories example:

```
- projects
  |_ my-awesome-laravel-app 
  |_ laradock
```

further inside the laradock directory, you will find this file `php-worker\supervisord.d\laravel-worker.conf.example`. Duplicate this file into `my-awesome-laravel-app-worker.conf` (the name could be different, as long as you end it with `.conf`). 

```
- projects
  |_ my-awesome-laravel-app 
  |_ laradock
     |_ php-worker
        |_ supervisord.d
           |_ laravel-worker.conf.example
           |_ my-awesome-laravel-app-worker.conf
```

Then modify the `my-awesome-laravel-app-worker.conf` content into:

```conf
[program:my-awesome-laravel-app-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/my-awesome-laravel-app/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
numprocs=8
user=laradock
redirect_stderr=true
```

And that's it for the worker configuration.

### Using the database queue connection

For a simple demonstration, we can use `database` for queue connection. So set the value in the laravel project `.env` like this:

```
...

QUEUE_CONNECTION=database

...
```

If you haven't created the `jobs` table, go ahead enter the laradock's workspace bash and execute `php artisan queue:table` and `php artisan migrate` to create it.

Now execute the simple mail sender command `php artisan example:send-mail` as it's instructed in my post about mailhog. If it succeeds, you should see the job enqueued inside the `jobs` table in your database.

### Run the PHP-Worker container

Say no more, run this command inside your laradock directory:

```
docker-compose up -d php-worker
```

Now the queue should do the magic, you should see the email in the mailhog [inbox](http://localhost:8025).

Have fun experimenting with php-worker in Laradock

```
laravel version used: 6.0 LTS
```
GitHub Workflow is very useful✨
Tags: git
Published: 2020-03-23 14:38:39

My github work flow yaml file for my gem 💎

``` yaml
name: gem name ci
on: push
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby: [ '2.6', '2.7' ]
    name: spp build ${{ matrix.ruby }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
      - name: install deps
        run: |
          gem install bundler:2.1.2
          bundle install --jobs 4 --retry 3
      - name: lint
        run: bundle exec rubocop --parallel
      - name: test
        run: bundle exec rspec
```
Gratitude journal - dev edition (23.3 - Stimulus)
Tags: gratitude, stimulus
Published: 2020-03-23 13:30:15

I started gratitude journaling a few months ago, and it feels nice.
It feels good to stop for a moment, find something you are grateful for or makes you happy, especially in these precarious times.

So, I decided to start another gratitude journal publically here, this one focused on technology, software and generally things I am grateful as a developer.

I will try to make a post at least once a week.
And for now...

..this week I am grateful for **Stimulus**

I guess many of you know about this [little js framework](https://stimulusjs.org) from Basecamp.
I have personally seen it first about six months ago thanks to my work at [NejŘemeslníci.cz](https://dev.to/nejremeslnici), where our front-end developers started using it some time ago.

As I am not front-end developer myself (I prefer backend, mostly in Python and recently in Ruby on Rails), I only have some little knowledge in js, and when I needed to use some (e.g. for my web app ketocalc), I just wrote some terrible code, which "just worked" (but was terribly unreadable, unmaintainable and added terrible class-naming scheme to my html).

Well, at work I learned some basics of stimulus and it seemed nice.
So this weekend I decided to finally improve code in my project, so I stopped being ashamed of it whenever I worked on that project.

I didn't manage to crack how to use neither `npm` nor `webpack`, luckily I can use stimulus without it (I know, I know, it's not optimal and I promise, I will get there someday).
I simplified my code (both js and HTML) immensely, replaced AJAX with fetch, DRYed my code, and got rid of most of jQuery.
I am so happy now.

I know that most of it is not because of `stimulus`. But it helped me with the process of writing nice, reusable code, and I love how it connects to HTML. I think it's really great js framework, especially for someone not very fond or skilled in frontend.

So, that's for this weeks gratitude.
Thanks for reading this, and let me know in comments what are you grateful for :)
Using Machine Learning to Prototype, Design & Output pre-made Code 👨‍💻️
Tags: webdev, tutorial, beginners, react
Published: 2020-03-23 14:31:36

Wouldn't it be great if AI did the job of designing and developing websites for you? Well, we are not quite there yet, but today I got to check out a system that is making steps towards that goal.

<a href="https://uizard.io/">UIzard</a> (We-zard) let me test out their system and I was able to see what it was like hand drawing wireframes and having their neural network and computer vision system adapt it into a design with actual outputted code as well.
{% youtube pipDLq4bzVo %}
The system they used let me do the following:
* Draw a wireframe
* Scan it into an actual design (based on a few templates they have)
* Modify and update the design (similar to sketch/figma)
* Create some workflows or notes to share with others
* Output code (html, css, react, vue, angular)

It's an interesting system.

Here is what I put into the system.
![UIzard Wireframe Adrian Twarog](https://adriantwarog.com/wp-content/uploads/2020/03/89845145_1931131010353668_8629517139448954880_n.jpg)

And this is what it spat out:
![UIzard UI Adrian Twarog](https://adriantwarog.com/wp-content/uploads/2020/03/generated-uizard-adriantwarog.jpg)

Of course, this is system is still in beta, and they probably are going to work to provide a lot more functionality, but it's still an interesting concept! I personally liked the fact that I could download for libraries such as React, or Styled Components!

![UIzard Code Adrian Twarog](https://adriantwarog.com/wp-content/uploads/2020/03/code-uizard-adriantwarog.jpg)

I will keep an eye on them to see what they plan to do for the future. Hope this was an interesting topic if you have things you wish me to review or cover, let me know in the comments!

<strong>uizard</strong>
https://uizard.io/

## Follow and support me: 
Special thanks if you subscribe to my channel :)
* [🎞️ Youtube](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ?sub_confirmation=1)
* [🐦 Twitter](https://twitter.com/adrian_twarog)
* [💬 Discord](https://discord.gg/nGdThpE)
* [💸 Patreon](https://www.patreon.com/adriantwarog)

## Want to see more:
I will try to post new great content every day. Here are the latest items:
* [Adobe XD to Fully Responsive WordPress Site](https://dev.to/adriantwarog/adobe-xd-to-fully-responsive-wordpress-site-16e0)
* [Adobe XD to HTML Full Process](https://dev.to/adriantwarog/adobe-xd-to-html-full-process-ao6)
* [Full Tutorial on how to use SASS to improve your CSS](https://dev.to/adriantwarog/full-tutorial-on-how-to-use-sass-to-improve-your-css-57on)
* [Creating a Mobile Design and Developing it](https://dev.to/adriantwarog/creating-a-mobile-design-and-developing-it-5c4o)
Need to stash untracked files? There is a way!
Tags: git, beginners
Published: 2020-03-23 14:29:07

You are in the middle of some work. You have created a bunch of new files and edited some existing ones when your boss comes and tells you to deal with an emergency bug fix. You realize you need to switch branches but your work is incomplete and you don't want to commit it just yet.

Stashing your changes is the best way to go. However, the default behavior of `git stash` is to stash only the tracked files. The untracked files will remain in your repo. Sometimes that is ok. You can have them there while you switch branches and deal with the emergency. But, in some occasions, their existence might interfere with other things (like changing the behavior of the software, or getting accidentally added to a commit).

I prefer to stash the untracked files every time I need to switch branches. That way I get a clean repo to work with. Less thinking required, and less room for error. It's the safest option.

So how do you stash both tracked AND untracked files?

Using:
``` bash
$ git stash --include-untracked
# or the shorter alternative:
$ git stash -u
```

> "Will this include the files in my `.gitignore`?"

No. This will only include the untracked files you see when you do `git status`. If you want to stash files included in `.gitignore`, use `git stash --all`.

> "How do I see what I have just stashed?"

To see all tracked files you just stashed use `git show stash`. To see all the untracked files you just stashed use `git show stash@{0}^3`. Unfortunately there is no way, that I know of, to see both the tracked and untracked stashed files using one command. This is due to the way Git stores and applies stashed changes.


<a href="https://chipper-musician-9131.ck.page/562695812e">![signup](https://dev-to-uploads.s3.amazonaws.com/i/cufm58ypdt0dilhlgh5j.png)</a>
Set up end-to-end tests in one minute
Tags: testing, javascript, node, opensource
Published: 2020-03-23 14:27:08

Use [QA Wolf](https://github.com/qawolf/qawolf) to set up [Jest](https://jestjs.io) and [Playwright](https://github.com/microsoft/playwright) end-to-end tests in one minute:

{% youtube e8tfR1Ey9DI %}

{% github qawolf/qawolf %}
React: Context
Tags: tutorial, beginners, react
Published: 2020-03-22 23:27:07

Using `useState` and `useReducer` are great but what if you want your state to be accessible through different components? Before, we would've used Redux but now we have React Context.

Context has three parts to it -- creation, provider and consumer.

**`createContext`**

We can create a Context using `createContext` and it takes the initial value you want. This initial value is used when the context has no corresponding value passed to the provider.

```react
const ThemeContext = createContext('light')
```

**`<Context.Provider>`**

The provider allows any descendants of this provider will have access to the current value of the context as well as any changes. The provider accepts a value prop where you can change the current value of the context.

```react
<ThemeContext.Provider>
  ...
</ThemeContext.Provider>
```

**`<Context.Consumer>`**

The consumer is basically the component where you'll have access to the current value of the context. When using this, the children is a render function which receives the current value as an argument.

```react
<ThemeContext.Consumer>
  {value =>
    ...
  }
</ThemeContext.Consumer>
```

**`useContext`**

An alternative way to get the value of a context is to use the hook `useContext`.

```react
const value = useContext(ThemeContext)
```

So how do we update the context's value? The context's value can be updated and kept either using `useState` or `useReducer`.

```react
// App.js
const [currentTheme, setTheme] = useState('light')
const toggleTheme = () => {
  setTheme(prevTheme => prevTheme === 'light' ? 'dark' : 'light')
}

const value = {
  theme: currenTheme,
  toggleTheme
}

<ThemeContext.Provider value={value}>
  <Content />
<ThemeContext.Provider value={value}>
```
```react
// Content.js
const { theme, toggleTheme } = useContext(ThemeContext)
toggleTheme()
```
Show Dev: Track Timezone - Track timezones in ease
Tags: showdev, webdev, opensource, javascript
Published: 2020-03-23 14:21:20

---
title: Show Dev: Track Timezone - Track timezones in ease
published: true
description: Track timezones in one single view. No signups or installing an app
tags: showdev, webdev, opensource, javascript
---
Hey Dev

I just hacked a weekend project to help teams and individuals to track different timezones on one simple page.

Based on the current events, I think most people are working remotely and I think this will help people to track the timezones in a simple way. No need for signups or installing yet another app.

I'm also planning to build a feature to create a simple sharable page with all the team timezones so that everyone can track easily.

Feedbacks are welcome. And don't forget to share it :)

You can check it out here
https://srebalaji.github.io/timezone-track/
A Flexible Open Source ERP Framework To Run Your Business
Published: 2020-03-23 14:19:31

<p>Running a successful business requires some method of organizing the information about all of the processes and activity that take place. Tryton is an open source, modular ERP framework that is built for the flexibility needed to fit your organization, rather than requiring you to model your workflows to match the software. In this episode core developers Nicolas Évrard and Cédric Krier are joined by avid user Jonathan Levy to discuss the history of the project, how it is being used, and the myriad ways that you can adapt it to suit your needs. If you are struggling to keep a consistent view of your business and ensure that all of the necessary workflows are being observed then listen now and give Tryton a try.</p><p><a href='https://www.pythonpodcast.com/tryton-open-source-erp-episode-255/'>Listen Now!</a></p>
Even more devs will be needed with current climate
Tags: onlinejavascriptbootcamp, higherdevsdemand, liveismovingtoonline
Published: 2020-03-23 14:18:21

---
title: Even more devs will be needed with current climate
published: true
description: With current situation more and more companies are moving online and the demand for developers is only going to increase. Now is a perfect timing to transition to more stable and lucrative tech career.
tags: online javascript bootcamp, higher devs demand, live is moving to online
---

Hi guys, 

We hope that you and your families are alright, healthy and safe during this unprecedented times. As we prepare and work with developers from all around the world you should know that we are here to support you in any possible way. 

I wanted to share some thoughts about how we see the current situation and why we should get ready for even higher global demand for the developers. 

Starting with the fact that our industry is pretty much unique in ability to work remotely from home, the productivity is not going to decrease compared to other industries.

All the companies with their core products being digital will not be affected by the current situation. And those affected ones will see why they should move into digital.

Companies already operating online as well as those which need to make a transition to online due to current climate will definitely increase/establish their online presence and operations with transition to online even more rapidly than before. 

With current short economic downturn there is a perfect opportunity to gain new skills and experience to be in position to benefit fast as the economy will rebound back on track. 

Although the unique moment we are living through present more psychological challenge than the actual systematic fail no doubt a lot of people from areas like retail, hospitality, service would be affected and we are ready to help as many of them as we can with giving new skills to move into a more lucrative and stable career in tech. 

Barcelona Code School has been offering a fully online mentored remote <a href='https://barcelonacodeschool.com/barcelona-code-school/javascript-full-stack-online-bootcamp/'>Web/Mobile Development Bootcamp</a> for years which you can start immediately to make the most of this temporary downturn. We made our curriculum to be suitable for beginners and for those with zero previous exposure to coding there is a handy pre-course aimed to bring you to a good starting point. 

Stay safe and learn JavaScript! 

-- George