teleren/devto huggingface dataset:
Git Hooks 101
Tags: git, hook, productivity, policy
Published: 2019-11-22 12:17:32



In this tutorial I won't focus on what `git hooks` are, I'll show u simple example on how you can use them

# What git hooks are?
From [git documentation](https://git-scm.com/docs/githooks.html#_description): 
```
Hooks are programs you can place in a hooks directory to trigger actions at 
certain points in git’s execution. Hooks that don’t have the executable bit set 
are ignored.
```
and in other words:
* hook is program that run when event occurs
* there is a directory with all the hooks

All the event are listed [here](https://git-scm.com/docs/githooks.html#_hooks) <br>
In this tutorial I want to focus on `Pre-Commit` event <br>

# Sample Hooks
In our `.git/hooks` folder we can find all the default hook samples:
```bash
$ ls .git/hooks
applypatch-msg.sample      post-update.sample     pre-push.sample     prepare-commit-msg.sample
commit-msg.sample          pre-applypatch.sample  pre-rebase.sample   update.sample
fsmonitor-watchman.sample  pre-commit.sample      pre-receive.sample
```

# Our Hook
In this 101 tutorial I'll show you how to create simple `git hook` that prevent `git commit` command to `master` branch <br>
Lets now create new file `pre-commit` without any file extension
```bash
$ touch .git/hooks/pre-commit
```

Now because `git` runs under linux (for windows using MinGW) the first line needs to be [Shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))

For Linux:
```bash
#!/bin/bash
```
For Windows it should be you git bash location, For example:
```bash
#!C:/Program\ Files/Git/usr/bin/sh.exe
```

next we need to execute `git branch` command in order to print our branch, but we want to know if we are currently on `master` by using `grep`:
```bash
git branch | grep "* master"
```
Now we warp with `if` with message:
```bash
if git branch | grep "* master" > /dev/null 2>&1
then
    cat <<\EOF
# Message
EOF
fi
```
in order to disable the commit we need to provide exit code which is not 0:
```bash
exit 1
```
And our hook for `pre-commit` looks like that:
```bash
if git branch | grep "* master" > /dev/null 2>&1
then
    cat <<\EOF
Commits are not allowed on branch Master!
EOF
    exit 1
fi
```
lets try:
```bash
$ git commit -m "Commit message"
Commits are not allowed on branch Master!
```

# Make it as Default
What is the problem with most people? is that we are lazy, we want to do something only once <br>
and we have this option using `git template directory` that you can find more about it [here](https://git-scm.com/docs/git-init#_template_directory) <br>
what that this tempalte direcotry does is when you are using `git init` command it will copy all the files under this directory whose name do not start with a dot <br>
now lets define our `template dir`:
```bash
$ export GIT_TEMPLATE_DIR=PATH
$ cd PATH
$ mkdir hooks
```
and under `PATH\hooks` create your hooks and enjoy :)

> Like this post? 
> Support me via [Patreon](https://www.patreon.com/eranelbaz)
> Subscribe to my [YouTube Channel](https://www.youtube.com/channel/UCVUNeBGM5wZJKcOx0QwAaTA?sub_confirmation=1)
I'm Celebrating 10k Followers Here on DEV! AMA!
Tags: ama
Published: 2019-11-22 17:56:21

## Hey Y'all 🤗

I'm Tori, a Flatiron School SWE graduate and lover of technical blogging. Yesterday I passed **10,000 followers** here on DEV, so I thought I'd celebrate 🎉 this milestone by doing an AMA. 

**Go ahead and ask any questions you have for me in the discussion thread below!**

![cat putting glasses on with the text "I'm ready"](https://media.giphy.com/media/CjmvTCZf2U3p09Cn0h/giphy.gif)

*Note: I'll also be doing an AMA over on Twitter at 5:00 pm PST.*
Laravel Authorization Policies – Part 2
Tags: laravel, laravel57, laravel58, laravel6
Published: 2020-01-02 18:50:25

---
title: Laravel Authorization Policies – Part 2
published: true
date: 2019-11-22 17:38:54 UTC
tags: Laravel,Laravel 5.7,Laravel 5.8,Laravel 6
canonical_url: https://codebriefly.com/laravel-authorization-policies/
---

 ![Laravel Authorization Policies](https://codebriefly.com/wp-content/uploads/2019/11/laravel-authorization-policies.jpg)

In this article, we will discuss “Laravel Authorization Policies”. As I already, Describe the Laravel Gates in my previous article. You have to take a look at Laravel Authorization with Gates article for better understanding. Basically, Laravel Policies are the best way to protect Model actions. Why we need Laravel Policy? Laravel Policy is a class, […]

The post [Laravel Authorization Policies – Part 2](https://codebriefly.com/laravel-authorization-policies/) appeared first on [Code Briefly](https://codebriefly.com).
Angular Moving Folders
Tags: angular, type
Published: 2019-11-22 17:33:41

**Scenario**

When following the SRP principal, we will have lots of small "generic" components, but projects don't always start that way.

Until we train ourselves, our project is likely to have monolithic code patterns needing to be broken down.

**Breaking Components Down**

We want to refactor monolithic code by splitting out anything not doing just one thing within that component. We want to "get to generic".

As we create these "generic" components, we want to put them into a new folder... e.g. "Common" for common/reusable components. By the end of your project, you will have this folder structure. 

![commoncomponents](https://thepracticaldev.s3.amazonaws.com/i/fayb4v3xryepb31rk433.PNG)

All of the generic components are in the folder named "Common". This is a great way to start your reusable components library.

**Auto Import Updating**

Visual Studio Code allows you to move components around in your project, and it will update all of the import statements automatically. 

Sometimes it seems to miss a few, no problem, just move the component back to starting location and then back again to new folder, this usually fixes App.Router's imports.  Note this technique also works for moving entire folders!

**Time Factor?**

Today, I just moved in 19 components into the "Common" folder, it took me 10 minutes to get it done!
If You Use Slack, Read This
Tags: slack, communications, discuss
Published: 2019-11-22 17:30:42

---
title: If You Use Slack, Read This
published: true
description: Hints and tips for effective Slack use in the Enterprise
tags: Slack, Communications, Discuss
cover_image: https://images.techhive.com/images/article/2017/02/p1200475-100708083-large.3x2.jpg
---

Slack is quickly becoming a de facto standard of corporate communications. I have scores of channels open across 8 Slack work spaces open on a regular basis. It can get overwhelming.

No one asked me, but I put together a few hints for using Slack most effectively in channels with large numbers of subscribers. Feel free to comment/argue below as you see fit.  

In any heavily-subscribed channel, there could be dozens of messages flying around, and these tips will help keep everyone organized. 

For these tips, I am assuming the mobile version of Slack.


1. If you simply want to acknowledge a message with a "thanks," "me too", "+1", or anything like that, you can do that without cluttering up the message with a bunch of one-word replies. Tap the message text. On the screen that appears, tap the . . . button and choose the appropriate emoji.

1. To reply to a message, use threads. Tap the message text. On the screen that appears, tap "Start a thread" if you are the first to reply. Otherwise, the thread replies will be displayed below the first message. In the latter case, simply type your reply in the "Add a reply" field at the bottom of the screen. There is a checkbox at the bottom of the screen labeled, "Also send to {channel}". Try not to use that, as it will also clutter up the main channel traffic.
    
1. To send a direct message to someone from the channel, tap their name or image, and then tap the "Message" button. This will let you send a private message to that individual. You can also initiate a voice call from the same screen, though that may not be as reliable.

1. You can tag specific individuals in messages and replies by typing @ followed by their Slack name.

1. Unless you are one of the leaders or owners of the channel, please do not use @here or @channel in your messages, as that will alert everyone.

1. A corollary to the above: in your notification settings for any channel you can choose to mute @here and @channel notifications entirely.

## Summary
Communicating effectively in large groups requires diligence and discipline. Following the simple rules above will make discussions easier to follow and understand.

Have any tips of your own? Please feel free to comment below.
What was your win this week?
Tags: discuss, weeklyretro
Published: 2019-11-22 17:26:18

---
title: What was your win this week?
published: true
description: Got to all your meetings on time? Started a new project? Fixed a tricky bug?
tags: discuss, weeklyretro
cover_image: https://cl.ly/188e843c2985/download/Image%202019-02-15%20at%202.36.37%20PM.png
---

👋👋👋👋

Looking back on your week -- what was something you're proud of?

All wins count -- big or small 🎉

Examples of 'wins' include:

- Getting a promotion!
- Starting a new project
- Fixing a tricky bug
- Cleaning your house...or whatever else that may spark joy 😄

![fun-dinner](https://media.giphy.com/media/duJTOfs3PW5Xy/giphy.gif)
Best Container Registry In The World Is Out Now!!
Tags: devops, docker, kubernetes
Published: 2019-11-22 17:18:49

Container technology has been around for a while, but since the arrival of Docker, many developers have been attracted to Containerization for agile development in the cloud.Thus, it's becoming very challenging to manage all their bundled code in them.
Now, you have a FREE tool that can help you getting along with it!
JFrog released [The JFrog Container Registry](https://jfrog.com/container-registry/) 
Why it is the best as my title says?
well, it has some really unique features you can't find in other container registries, like: Generic, Remote and Virtual repositories with rich metadata.
So go and give it a try @ https://jfrog.com/container-registry/
If you have any questions, you can also reach out and asked them @ https://stackoverflow.com/questions/tagged/jfrog-container-registry
Surprises.
Tags: discuss
Published: 2019-11-22 17:01:18

I mentor and train my employer's college hires in front-end development. At the end of the 12-week program, the college hires present what they've learned to their managers and their leads.

I have one question I like to ask them, to help them prep for their demos:

**"What surprised you?"**

I get lots of responses to this. Maybe they were surprised by collaboration tooling, or they learned how to ask questions, or they struggled with Git. All surprises, big or small, are valid here.

I think this a great question to ask for self-reflection, for two reasons:

1. *A surprise is a thing learned.* Why did something surprise you? You had expectations that things were one way. A surprise disrupts your expectations and forces you to learn something new.

2. *Surprises require reaction.* Learning something is only half of the puzzle. You can learn many things and never act on them. What's the point of that? Surprises require you to adjust your status quo and adapt.

How do you use your surprises to grow and be better?
Artificial Intelligence Predicted the Trend for Chatbots
Tags: ai, chatbot
Published: 2019-11-22 16:31:43

Chat-bots for improving meeting efficiency became the current market trend - as [Signum.AI reported in June.](https://signum.ai)

Meetings are an integral part of any business. A good approach to the organization and competent planning allows us to work more efficiently. But what to do if every year the world speeds up and becomes more complicated? Right, ask for help from AI. The market of intelligent AI-assistants for the organization of working time continues to grow and attract the attention of investors.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/96m26f869cm9kkkxos6q.jpeg)

A few recommendations that will help you avoid mistakes when developing the first chatbot:

- Identify the goals you need to achieve with the bot. Perhaps this is client personalization, increased demand for the company's products and services, traffic, or something else.

- Explore the intended target audience. It can be clients, existing employees, investors. Gather feedback that will be useful during development and identify triggers to encourage people to use the bot in the future. For example, an effective trigger is a constant discount when placing an order through a chatbot.

- Determine the functionality that you need to lay in the chatbot - the ability to leave a request, conduct payment transactions, consultations, and so on.

- Learn the technical features of communication channels, the possibilities of introducing a chatbot in them. Choose channels that meet all the functional requirements of future bot. There are not many communication channels, use at least two.

- Develop script logic with an intelligent map. Write dialogue and a script for the interaction of the bot with the user. In order for the bot to fulfill non-standard user requests, set as many different conditions as possible for one action.

- If you plan to develop a chatbot using speech synthesis and semantics technologies, first implement it on the basis of logical elements (look into the previous point). First you need to collect information about user behavior and psychology. In the course of this, the basis for introducing new technologies will gradually be gathered.

- Identify software and third-party services for integration. For example, it can be a CRM system or an online cash register.

- Identify the technical tools for the project — the programming language and software architecture. For example, using the C# development environment based on the .NET Framework software platform, you can implement a bot of any complexity.

- Place points to start user communication with the bot in the form of QR-codes, links, and widgets.
__________________________

[Signum.AI](https://signum.ai) constantly analyzes over 300,000 blogs, forums, portals and social media accounts to keep track of the emergence of new trends at the earliest stages.
YOUR CLONED PROJECT FROM GITHUB IS NOT RUNNING ON THAT NEW COMPUTER BECAUSE NODE MODULE WAS NOT PUSHED TOGETHER WITH OTHER FILES
Published: 2019-11-22 16:06:09

So, I was having an issue with git and Github today.
I was working on a project on my old computer and decided to clone it and continue with the project on my new computer, after pushing my files to Github from my old computer, I then cloned it on my new computer and decided to continue working on it. To my surprise, I started getting error messages, so basically, my project refused to run on my new computer.

After a few hours of not understanding what went wrong, I noticed my node module from my old computer did not get pushed with the other files, reason being that there was a 'gitignore' file in my project. 

Ultimately, what the 'gitignore file does is (as the name implies) ignore the node module and does not allow it to get pushed with the rest of the files. 

Although you can choose to push your node module too, but it would take a very long time for your files to get uploaded and at the same time when you try to clone it some other time.

What you can do when you clone your project on another computer is to run 'npm i' in the terminal and wait for it to finish doing its thing, after which you can now by then, run your project which should now work properly.
D3js fundamentals Part 3 SVG Path
Tags: javascript, webdev, d3js, tutorial
Published: 2019-11-22 15:30:02

In the last article we learnt about svg, svg shapes and basic line generator using d3js and why `path` is used for generating lines. 

{% post https://dev.to/saikiran/d3js-fundamentals-part-2-5bek %}


In this article we will learn about `path` data and how we can make any shape we want with it. It is not necessary to learn about the `path` data if you want to just learn d3js, you can skip this part as this sometimes become too confusing to pickup the concepts and it just helps you in understanding what goes on in the background when you make a `path`. 
Lets take a simplest example making a line 

{% codepen https://codepen.io/krngd2/pen/LYYvNNX %}

The data we passed to `path` is **M100,100 L400,400**.
Path data always starts with `M` means move, from which point you want to start drawing, every co-ordinate take two point x and y. We gave `M100,100` which starts from 100,100 co-ordinates of the svg. There is also lowercase `m` which moves according to its relative parent instead of svg. After that we have `L400,400` representing line and its co-ordinates, line is drawn from the start point of `M` or `m`. Lower case `l` takes points from its parent instead of svg.

Similarly we have 

* Move 	        M m 
* Line	        L l 
* Horizontal    H h => To draw a line horizontally
* Vertical      V v => To draw a line Vertically
* Close path    Z   => joins the start and end points with a line 

Here are some examples of Horizontal, Vertical and Close Path  

{% codepen https://codepen.io/krngd2/pen/ExxJNRO %}

And to make curves we have, I have built some visualizers to make it easy to understand. Play with the slider and see which values effects which part of the curve.

* Cubic Bézier 		
  * C, c 
    {% codepen https://codepen.io/krngd2/pen/RwwvmVW %}
  * S, s  
    {% codepen https://codepen.io/krngd2/pen/RwwvmMR %}
* Quadratic Bézier 	
  * Q, q	
  * T, t	
    {% codepen https://codepen.io/krngd2/pen/wvvNbVy %}
* Elliptical arc 		
  * A, a    
    {% codepen https://codepen.io/krngd2/pen/PoogNPo %}


https://dev.to/saikiran/d3js-fundamentals-part-4-scales-18og
realMethods now certified on Nutanix Acropolis Hypervisor
Tags: certified, devops, virtual
Published: 2019-11-22 15:23:23

Nutanix has certified realMethods Project Generator as Nutanix Ready AHV in Applications on Nutanix Acropolis Hypervisor.

Nutanix Ready identifies recommended applications and solutions that are trusted to enhance the Nutanix delivery infrastructure.
Software development companies in ahmednagar
Tags: software, development, php, hiring
Published: 2019-11-22 14:57:41

Top Companies Smart Custom Software Development

Looking for custom software development solutions? Read this post to know the steps for smart and effective custom software development.

https://www.rbtechservices.in/

Visit our blog: 

https://software-development-in-ahmednagar.blogspot.com/

#software #effective #system #smart #solution #itcompany #ahmednagar #softwareservices #advantages #development #design
Day 11 of⚡️ #30DaysOfWebPerf ⚡️: Lazy-load images
Tags: webperf, performance, images, analytics
Published: 2019-11-22 14:53:20

{% twitter 1197888953535418368 %}
{% twitter 1197888964667068416 %}
{% twitter 1197888967561162761 %}
{% twitter 1197888968802652160 %}
Daily Challenge #123 - Curry me Softly
Tags: challenge
Published: 2019-11-22 14:49:49

---
title: Daily Challenge #123 - Curry me Softly
published: true
series: Daily Challenge
description: Return a curried function.
tags: challenge
---
*Disclaimer*: Currying is not exactly what is described below. Stretch your mind!
Task

Currying is a technique named (as is the language Haskell) after the mathematician Haskell Curry which allows a function's arguments to be fed to it through separate instances of running that function. 

**Challenge**
Create a function which accepts a single argument of another function and returns a "curried" version of that function.

For example, take the following function:
<pre>
function adder(arg1, arg2) {
  return arg1 + arg2;
}
</pre>
This function would normally be invoked like so:
<pre>
var example = adder(1,3); // 4
</pre>
A "curried" version of this function could be executed in either of the following ways
<pre>
var example = adder(1)(4); // 5
</pre>
OR
<pre>
adder(5)
var example2 = adder(6); // 11
</pre>
***
Your goal is to produce a higher-order function that accepts another function as an argument and returns a "curried" version of that function.
<pre>
function adder () {
  return [].slice.call(arguments).reduce(function(a,b){
    return a + b
  },0);
}
var curryAdder = CurryIt(adder);
</pre>
This "curried" version of the original function should expand its arguments when invoked with arguments. It should allow multiple arguments to be passed into each invocation.

It should execute the original function and then restore that function's original argument-less state when invoked without arguments.

See example here, assuming curryAdder from above has been created already:
<pre>
curryAdder(1);
curryAdder(1,2,3);
curryAdder(2)(2,5);
var example = curryAdder(); // 16
curryAdder(1)(2);
var example2 = curryAdder(); // 3
</pre>

For fun, let's make sure this works with native global functions and methods too! (will involve some context)
<pre>
var curryEval = CurryIt(eval);
curryEval("var y = function(){return true}");
curryEval();
y(); // => true
</pre>
Context should be fixed the first time the "curried" function is called after creation.

Happy coding! :)

***
_This [challenge](https://www.codewars.com/kata/55ba24f1cb367c48ac0000a2) comes from SirRodge on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_