teleren/devto huggingface dataset:
Change CSS of PC on button click in CC?
Published: 2019-03-04 09:46:49

---
title: Change CSS of PC on button click in CC?
published: true
description: 
tags: 
---
To start with this blog post, let me put the focus on some of the terminologies that I have used in the title of it. So, the agenda is to change the CSS of our Parent Component with the help of a button inside our child component.

For those who are totally new to Angular, CSS stands for Cascading Style Sheets which help developers to style their Angular Applications. With the release of Angular 7, when we create a new Angular application using CLI, it asks us which style sheet format would we like to add to our application. See in the image below:

https://thepracticaldev.s3.amazonaws.com/i/z8xhea1ldb5xlz6o4gab.png

Proceeding after choosing the convenient stylesheet format, CSS for the sake of this blog post, we will create two components inside our application.

To create a component using CLI, we use:

ng g c component-name

To start with, create a button inside the template of a component.

https://gist.github.com/NishuGoel/c63e6e603c94fb1c466bc1288dd121e9

Now to access this button to change the CSS on the parent component, we use @Output() and EventEmitter. To do that,

https://gist.github.com/NishuGoel/e6bcf39205dd4c7bbfea2ea272ef73b5

Now, let us go to other components to use this button and change the CSS.

https://gist.github.com/NishuGoel/3cea7023c8933b001e7d4ca7b1d30690

And the Parent Component looks like this.

https://gist.github.com/NishuGoel/67df7aac7e60c09a83d6e5c9017ac6a1

If we look at the CSS file now, it is kept very simple for understanding this article.


https://thepracticaldev.s3.amazonaws.com/i/e2blr1wbtmlmc9fp3uvi.png

Having done this, let us look at the results now:


https://thepracticaldev.s3.amazonaws.com/i/z6nw9hoslmmu3gieqne2.gif
What’s Tripping Up Uglifier?
Tags: programming, ruby, rails
Published: 2019-03-06 12:37:11

---
title: What’s Tripping Up Uglifier?
published: true
tags: programming,ruby,programming,rails
canonical_url: https://jsrn.net/programming/2019/03/06/whats-tripping-up-uglifier.html
---

In production mode, Rails 4 uses the `uglifier` gem to compress your JavaScript code into something nice and small to send over the wire. However, when you’ve got a syntax error, it can fail rather… ungracefully.

You get a big stack trace that tells you that you’ve got a syntax error. It even helpfully tells you what the error was! Unexpected punctuation. There’s a comma, somewhere. Where? Who knows. It doesn’t tell you.

If you have a large project, or have multiple people making large changes, it can be a little time consuming checking the diffs of recent commits to figure out where the error was introduced. Here is how you can use the rails console to at least find the offending file:

Since the uglifier doesn’t run in development, let’s drop into the rails console in production mode:

```
RAILS_ENV=production rails c
```

Now we can use the following snippet of code to find our errors:

```ruby
# Take each javascript file...
Dir["app/assets/javascripts/**/*.js"].each do |file_name|
  begin
    # ... run it through the uglifier on its own...
    print "."
    Uglifier.compile(File.read(file_name))
  rescue StandardError => e
    # ... and tell us when there's a problem!
    puts "\nError compiling #{file_name}: #{e}\n"
  end
end
```

This saved me a little time recently, so I hope it will be handy to someone else.
How do you get Node.js apps to production?
Tags: discuss, node, javascript
Published: 2019-03-05 23:31:41

---
title: How do you get Node.js apps to production?
published: true
tags: discuss, node, javascript
---

You've built a cool Node.js application and now it's time to get it into production. How do you go about it? 🤔

1. What tools do you use to deploy?
2. What modules do you most depend on?
3. What's painful in how you currently have to deploy and wish could be nicer?

_At Microsoft we want to understand how you work so we can help you build awesome projects easily._
Hack Raspberry Pi to tell you a joke
Tags: iot, node, ibmwatson, chatbot
Published: 2019-03-05 23:16:36

---
title: Hack Raspberry Pi to tell you a joke
published: true
description: This blog post is about enabling joking skill to the Raspberry Pi - now you can easily and fast build a basic "fun" skill and add it to your personal assistant. And this is the DIY personal assistant that is based on the basic IoT device - Raspberry Pi computer.
tags: IoT, node.js, IBMWatson, chatbot
---
[This blog post is about enabling joking skill to the Raspberry Pi - now you can easily and fast build a basic "fun" skill and add it to your personal assistant. And this is the DIY personal assistant that is based on the basic IoT device - Raspberry Pi computer.](https://blumareks.blogspot.com/2019/03/hack-raspberry-pi-to-tell-you-joke.html)
Laxy: Lazy initialization in JavaScript
Tags: githunt, javascript, package
Published: 2019-03-05 23:09:51

---
title: Laxy: Lazy initialization in JavaScript
published: true
tags: githunt, javascript, package
---

{% github jamestalmage/laxy %}

Laxy exports a single function that looks like this:

```JavaScript
laxy(fn, ...args)
```                 

I think the easiest way to explain how it works, is with an example. Assume this is running in Node:

```JavaScript
const laxy = require("laxy");
const fs = laxy(require, "fs");
```

Now, the `fs` module will be loaded, only when it is used. `require` is called with `"fs"` as the argument, the first time you try to use `fs`.

# How it works

When you call `laxy`, it immediately returns an object. This object is a [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy). The first time you use that object in any way that is supported by a Proxy handler, `fn` is called, and the object starts behaving exactly like the object returned by `fn`.

I used it to dramatically speed up the cold boot time of [Google Cloud Functions for Firebase](https://firebase.google.com/docs/functions/). Each function gets its own "container", but that container also includes the code for all the other functions, meaning I was loading dependancies for every function, not just the on in the current container. So I wrapped all dependancies in `laxy`, so they're only loaded the first time they're used.
Two days ago I released Matter
Tags: css, html, beginners, material
Published: 2019-03-05 23:07:01

---
title: Two days ago I released Matter
published: true
description: This project goes back to around half a year before, when I needed just a few nice looking components for a CodePen demo. Buttons, Slider, Switch, Textfield, some of the usual components of a web page.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/unq0e9y8lyy8ednjitkb.png
tags: css, html, beginners, material
---

This was the first release of [Matter](https://github.com/finnhvman/matter). I never did open source before, so this was my first release ever in the scene.

This project goes back to around half a year before, when I needed just a few nice looking components for a [CodePen demo](https://codepen.io/finnhvman/full/oPwXRa). Buttons, Slider, Switch, Textfield, some of the usual components of a web page. I'm a big fan of Material Design, and I couldn't find any lean and simple way to integrate these Material components into my Pen. I thought it shouldn't be hard to implement them.

I'm a big fan of [Pure](https://codepen.io/finnhvman/full/xJRMJp) [CSS](https://codepen.io/finnhvman/full/xXpzVN) [Stuff](https://codepen.io/finnhvman/full/gzmMaa) too. I wondered if these components could be done without JavaScript. It turns out you can go a [long way](https://codepen.io/finnhvman/full/zMKagM) with this restriction. Not full blown functionality though, but enough for a lot of use-cases.

CodePen has a nice community, I received some good feedback for the Material components. Yet, the Pens were still kind of impractical. I mean, I spent quite some time to perfect each of them, and there was no easy way for others to benefit from them. Next step: open source.

In the last two months I have been figuring out solutions for the typical problems (I guess) of an open source project. The most time I spent on was testing, and I think it's one of the best things of the project! (But what do you test in CSS? - you might ask, well that's another story). Anyways, Matter has a [0.1.0 release](https://github.com/finnhvman/matter/releases/tag/0.1.0). It ain't much, but it's honest work:

![13 Matter Components](https://thepracticaldev.s3.amazonaws.com/i/jr9fylg9twj1w8qo142q.png)

I can imagine a number of directions this project would go, I wonder which one will it be...
Array.foreach vs for() 😰
Tags: typescript, javascript, iteration, angular
Published: 2019-03-05 22:43:15

---
title: Array.foreach vs for() 😰
published: true
description: Diferencia entre foreach y for
tags: TypeScript, JavaScript, Iteration, Angular
---

La verdad es que siempre pensé que eran homónimos, no pensé que podría haber tanta diferencia entre una función y otra.

Pues resulta que realizar un `foreach` implica que la ejecución va a tardar nada más ni nada menos que un 96% más(!!!) que un `for` 😳 y para ejemplo un botón:

```
Benchmark.prototype.setup = function() {
    // Populate the base array
    var arr = [];

    for (var i = 0; i < 1000; i++) {
        arr[i] = i; 
    }
   
    function someFn(i) {
        return i * 3 * 8;
    }        
};

```

Al ejecutar esto, tenemos lo siguiente (puedes probar [aquí](https://jsperf.com/fast-array-foreach/148)):

![alt text](https://amatos.dev/content/images/2019/03/image.png "Logo Title Text 1")


Obviamente esto se puede notar cuando estamos trabajando con miles de registros, pero es mejor implementar buenas prácticas desde un principio 😌

Con esta evidencia, definitivamente quedo prohibido de utilizar `foreach` en cualquier desarrollo que haga en Angular en favor al simple y querido `for` de toda la vida ❤

Por cierto, eso no aplica a TypeScript ya que el `foreach` se compila al `for` que nos gusta 😬
I'm Jon, and I support women devs.
Tags: wecoded
Published: 2019-03-05 22:38:24

---
title: I'm Jon, and I support women devs.
published: true
tags: shecodedally
---

I'm a teacher now, but I've been programming computers in one form or another since the early 1980's when I was first introduced to them in junior high school. 

In all those years, I have yet to find a compiler switch, interpreter setting, debugging command, editor configuration, or library function which has ever asked:

- What gender are you?
- Who do you love?
- What bits of anatomy were you born with?
- In what country were you born?
- What colour is your skin/hair/eyes?
- What holidays do you celebrate?
- What language do you speak?
- How fast can you run?

I know there are people out there for whom the "correct answers" to these meaningless questions are, sadly, important. I also know that often, these people look a lot like me.

I left my job in tech to become a teacher a few years ago (face it, tech companies have enough straight white cismale engineers). Now my job is teaching new generations of excited skilled makers (who look a lot less like me) how to build the cool shit they imagine, then getting myself and others the hell out of their way while they reinvent the world.

Computers have never cared about the people who program them. That means we have to.
Nevertheless, Jenn Coded
Tags: wecoded
Published: 2019-03-05 22:32:14

---
title: Nevertheless, Jenn Coded 
published: true
tags: shecoded
---

## I continued to code in 2019 because...

I love it. I love creating websites and apps. I love solving problems for people. I love helping others learn.

## I deserve credit for ...

Quitting a toxic team.  I deserve credit for taking time off to figure out if I really truly wanted to stay.  I deserve credit for speaking up about what has happened to me in my career in tech.

## I hope to see my work/developer/tech community...

Really challenge the idea of the pipeline this year. URMs (underrepresented minorities) and white women do not get the same opportunities.  We fight against a system that doesn't understand why we don't fit in or can't just be one of the guys.

I hope to see more people feeling welcome and wanted in tech.

This year was a hard year for a lot of people. Let's make next year better!
I'm Mike, and I support women devs.
Tags: wecoded
Published: 2019-03-05 22:31:21

---
title: I'm Mike, and I support women devs.
published: true
tags: shecodedally
---

## I will advocate for gender equality by...
Providing a public platform for women developers by having at least 40% of the guests on season 3 of my development podcast (www.developingup.com) be women developers.


## I hope to see my school/work/developer/tech community...
Increase opportunities and positions for women developers. Provide a safe and supportive space for all women.

## My advice for fellow allies is...
Always approach a situation with the premise of "What support are those I am an Ally for asking of me and how can I support them?"
Nevertheless, Maddie Coded
Tags: wecoded
Published: 2019-03-05 20:32:41

---
title: Nevertheless, Maddie Coded 
published: true
tags: shecoded
---

## I continue to code in 2019 because back in September 2015, I completely changed my life. 

For over a decade, I was a professional musician, performing with the Lyric Opera of Chicago, Milwaukee Symphony, Hawaii Symphony, and teaching both flute and piano. I have been a musician since age 8, and have an undergraduate degree and Masters in music performance. Right before I turned 40, I had had it with being underemployed, auditioning incessantly, constantly competing simply to make a living. 

I do not have an "opportunistic" personality, nor a drive to step on someone to get ahead/get the gig. Because of this, I decided to pivot my life, and turn my skillset (focus, discipline, attention to detail, problem solving, etc) into a career as a coder. I went to a bootcamp, back in 2015, and have been working as a professional developer, first coding in Rails (Ruby) and JavaScript for 2 years at a startup, and now as a Python developer (with some SQL) for about a year, at a larger/more organized company. 

Feel free to read more about my journey at https://madelenecampos.com/. Let my middle-aged self tell you that it is NEVER too late to learn how to code. Coding has brought options, opportunity, and stability into my life. I am forever grateful for this career and regret nothing!

This post was written as part of the "Nevertheless, She Coded" event. An event that amplifies of the journeys of women and non-binary people who code.
I am looking for an Email Service Provider
Tags: advice, help, webdev
Published: 2019-03-05 22:00:17

---
title: I am looking for an Email Service Provider
published: true
description: Advice for a side project
tags: 
 - advice
 - help
 - webdev
---

I am about to start a side project, it´s a web page for a local business. The features are:

- Home
- About us
- Booking / Ask for a quote

I have already set up a static page with Jekyll for the first two and **I wish to keep the page static, with almost zero backend code.** That's why I am looking for a way to **send an email with just a few lines of code** using some external SaaS.

It would be nice if the service has:

- Easy API
- Templates
- Free Tier
Image moderation system in minutes
Tags: machinelearning, javascript, serverless, node
Published: 2019-03-05 21:41:14

Every user generated content platform needs some sort of content moderation system to make sure that the content is appropriate and respectful, otherwise you might get some serious negative feedback from your users (talking from experience 😵).
In this post I would like to talk specifically about image moderation and how easy it is to build a system which rejects NSFW images from your application. 🙈

## Google Cloud Vision

> Enables developers to understand the content of an image by encapsulating powerful machine learning models in an easy-to-use REST API.

I will be using the Cloud Vision API to automatically detect inappropriate images powered by [SafeSearch](https://support.google.com/websearch/answer/510). SafeSearch rates your image by the likeliness of the following: adult, spoof, medical, violence and racy. In our case (NSFW) adult, violence and racy might be the metrics we are looking for. You can try the API for free to see how it's like [here](https://cloud.google.com/vision/).
Of course there are many alternatives to Cloud Vision but this is my favorite.

## Server-side

We will be using Node to write our moderation code and the [@google-cloud/vision](https://github.com/googleapis/nodejs-vision#readme) package.

First, we have to initialize our annotator so we will be able to use it later on
```js
const vision = require(`@google-cloud/vision`);
const client = new vision.ImageAnnotatorClient();
```

Next, let's say a user wants to upload an image to our server and we would like to reject the image if it is NSFW.
```js
const veryLikely = detection => detection === 'VERY_LIKELY';

const likelyOrGreater = detection =>
  detection === 'LIKELY' || veryLikely(detection);

const moderateContent = url =>
  client.safeSearchDetection(url)
    .then(([result]) => {
      const detections = result.safeSearchAnnotation;
      return likelyOrGreater(detections.adult) || likelyOrGreater(detections.violence) || veryLikely(detections.racy);
    });
```

Our function `moderateContent` gets a `url` as parameter (it can actually receive also `buffer`), this `url` points to a local image file or a remote one. The functions returns a Promise which resolves to true if the content has to be rejected or false otherwise. It actually contains only one third-party call to Cloud Vision API to run a SafeSearch detection on the provided image. SafeSearch ranks the image with the following rankings:
`UNKNOWN, VERY_UNLIKELY, UNLIKELY, POSSIBLE, LIKELY, and VERY_LIKELY`.
I set the threshold to adult and violence ranking "likely" or better and racy to "very likely", obviously you can set your threshold to whatever you want.


Using the `moderateContent` function our server can decide whether to proceed with the provided image or to reject it with error code 400 for example.


I hope that now you understand how easy it is to implement a content moderation system, all you need is a few lines of code and a Google Cloud account.


Good luck, let me know how it goes in the comment below :)
Nevertheless, rhkrys Coded
Tags: wecoded
Published: 2019-03-05 21:36:56

---
title: Nevertheless, rhkrys Coded 
published: true
tags: shecoded
---

## I started/continued to code in 2019 because...
like automation... want to work efficiently 

## I deserve credit for...
being an entrepreneur, mom and vegan 

## I hope to see my school/work/developer/tech community...
grow and become easier to access. I want my mom to feel comfortable running Jenkins jobs.
[astuce] Accéder directement à la configuration d'un plugin dans Joomla! grâce à un lien
Tags: tip, joomla, pluginconfig, link
Published: 2019-07-28 22:14:36

---
title: [astuce] Accéder directement à la configuration d'un plugin dans Joomla! grâce à un lien
published: true
tags: tip,joomla,pluginconfig,link
canonical_url: 
---

Supposons que votre plugin soit un plugin système appelé coucou. (plg\_system\_coucou)

La structure de base du lien pour accéder directement au plugin dans votre admin est donc: 

<samp>https://www.example.com/administrator/index.php?option=com_plugins&amp;filter.folder=<span style="color: #ff0000;">system</span>&amp;filter.element=<span style="color: #0000ff;">coucou</span></samp>

Remplacez par vos propres valeurs bien entendu.

A bientôt pour de nouvelles astuces!
Nevertheless, Jess Crees Coded
Tags: wecoded
Published: 2019-03-05 20:54:30

---
title: Nevertheless, Jess Crees Coded 
published: true
tags: shecoded
---

I continued to code in 2019 because I love solving problems and building something from nothing and I can't think of many other jobs where I could be this interested in my work.

However I deserve credit for dealing with all the male egos in my workplace while being the only woman in the company and therefore having no support against their bullshit.

I hope to see more change in the tech industry so that by the time I retire I will be working in a 50% woman populated workforce. I've been working towards that by mentoring women who want to enter tech and one of them has decided to study a degree in computer science to facilitate their career change! So we're getting there, one person at a time x
Nevertheless, Julie Coded
Tags: wecoded
Published: 2019-03-05 20:38:06

---
title: Nevertheless, Julie Coded 
published: true
tags: shecoded
---

## I code because...
It's a skill no one can take away from me. In my full time job, I'm given autonomy and creativity to solve problems. And since I work from home, I have time to enjoy whatever I want! It's so cool to build my own networks, firewalls, VPN into microprocessors. 

## I deserve credit for...
going from a bubble tea waitress to holding a position as a Senior Software Developer in one year. 


## I hope to see my tech community...
include more technical female communities. I live in a big city that doesn't have a strong tech presence. Many female-oriented tech meetups are not as technical as I would like them to be. A "Women Who Code" chapter is opening up today that aims to bring more talks focused on tech and not on gender diversity.
I'm Chris Young, and I support women Software Engineers in Dev, Ops, Test and beyond
Tags: wecoded
Published: 2019-03-05 20:37:54

---
title: I'm Chris Young, and I support women Software Engineers in Dev, Ops, Test and beyond
published: true
tags: shecodedally
---

I will advocate for gender equality by continuing to hire women software engineers and paying and promoting them in symmetry with their male colleagues.  I will continue to sponsor events like Rails Girls.  

Outside of work I will continue to work with the girls and boys at the code club at my son’s school.

I hope to see my work achieve gender balance in hiring and in promotion to leadership.

My advice for fellow allies is hire more women, support their voices in meetings and online.  Sponsor community events and invitatives.  Get involved with education too!
Nevertheless, fallenangyl18 Coded
Tags: wecoded
Published: 2019-03-05 20:15:44

---
title: Nevertheless, fallenangyl18 Coded 
published: true
tags: shecoded
---



During this last year I have completed my B.S in Software Development and Security.  I did this as icing since I had been programming professionally since 2007.  Unfortunately,  I felt I needed my degree as irrefutable proof that I have some sort of clue as a professional. I keep coding because I love being challenged and building useful things from nothing. 

Keep at it Sisters!

Fallenangyl18
Nevertheless, Alina Coded
Tags: wecoded
Published: 2019-03-05 20:14:34

---
title: Nevertheless, Alina Coded 
published: true
tags: shecoded
---

## I started/continued to code in 2019 because I really want to grow as a developer.

## I deserve credit for committing to learning Java this year and for navigating the Java journey as the only woman in the engineering team. Both are exhausting, but I'm not giving up! 

## I hope to see my tech community full of supportive and mentoring senior fellows. I dunno where they are, to be honest..
Nevertheless, pappleton Coded
Tags: wecoded
Published: 2019-03-05 19:36:32

---
title: Nevertheless, pappleton Coded 
published: true
tags: shecoded
---

## I started/continued to code in 2019 because I want to better understand the perspective of the developers/teams I work with and coach.  I think it is important to experience what you are asking other team members to do especially when it is uncomfortable.  

## I deserve credit for being able to push developers and architects outside their comfort zones to do pair programming, BDD, and TDD.

## I hope to see my community continue to push the boundaries of delivering valuable software faster and with high quality.