teleren/devto huggingface dataset:
GroupBy по нескольким значениям в Laravel
Tags: php, webdev, laravel, groupby
Published: 2018-02-19 20:32:52

---
title: "GroupBy по нескольким значениям в Laravel"
published: true
tags: php, webdev, laravel, groupBy
canonical_url: http://phpprofi.ru/blogs/post/97
---

В Laravel начиная с версии 5.5.29 можно группировать коллекции по нескольким критериям. Давайте посмотрим, что это означает и как это работает.

![](http://phpprofi.ru//resources/img/blogs/bf9c09d1-c041-48b9-9414-73b4d0464031.jpeg)

## Подготовка

Итак, эта статья о новой функциональности в фреймворке Laravel. Но прежде чем мы посмотрим как она работет сейчас, давайте посмотрим как она работала раньше. Метод **`groupBy`** является методом класса **`Collection`**. Для наших примеров я создам немного данных, с которыми мы будем работать. `Students` будет фабрикой состояний для передаваемого класса `User`.

```
// Default user factory which comes with Laravel
$factory->define(App\User::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
        'remember_token' => str_random(10),
    ];
});

// Our new students state
$factory->state(App\User::class, 'students', function (Faker $faker) {
    return [
        'skilllevel' => collect(['beginner', 'intermediate', 'professional'])->random(),
        'teacher' => collect(['Peter', 'Markus', 'Chris'])->random(),
    ];
});
```

----
Читать далее: http://phpprofi.ru/blogs/post/97

----
En: https://christoph-rumpel.com/2018/01/groupby-multiple-levels-in-laravel
Dir was unexpected in Batch
Tags: batch, cmd, batchcode, help
Published: 2018-02-05 13:07:00

---
title: Dir was unexpected in Batch
published: true
description: 
tags: Batch, CMD, Batch Code, Help
---
Hello, I have this line of code:
if %Monitor%==No if %Sub%==Yes dir /b /s "%Folder%">Control
Unfortunately it keeps saying "Dir was unexpected". Any ideas?
Do you use any special glasses for work?
Tags: discuss, eyewear, health
Published: 2018-02-05 10:51:19

---
title: Do you use any special glasses for work?
published: true
description: Because we stare at a screen for quite a long time
tags: discuss, eyewear, health
---

Just curious, I heard that there are some glasses designed to block blue light. I was wondering if you were using such glasses, or any other special items to protect your eyes? What would you recommend? Do such glasses actually work?
Explain Cgroups like I'm five
Tags: explainlikeimfive, linux
Published: 2018-02-05 08:44:44

---
title: Explain Cgroups like I'm five
published: True
description: Monday's morning big question.
tags: explainlikeimfive, linux
---
Hey, wake up its Monday, we need to explain to a 5 year old what are Cgroups and why they are important.
Evening Rust: Episode 11: Moving on... Tron roundup
Tags: video, coding, rust, algorithms
Published: 2018-02-05 08:09:16

---
title: "Evening Rust: Episode 11: Moving on... Tron roundup"
published: true
description: Bye bye Tron, hello Knapsack problem.
tags: video, coding, rust, algorithms
cover_image: https://thepracticaldev.s3.amazonaws.com/i/az05ahv9hz1srkc5jysf.jpg
---

{% youtube Z9K9WZ-JBes %}

We kick it off with a golf game in which we come second somehow! 

I explain why I'm moving on from the Tron game for now, after showing the points of consideration. 

We pick up a new knapsack problem, code the initial solution and then drop the ball on swapping. But we'll get back to it next time. At least I learned a few more Rust bits

Subscribe to my [Twitch Channel](https://www.twitch.tv/mortoray) to watch live.
Pluralsight
Tags: softwaredevelopment, c, development, learning
Published: 2020-01-01 09:48:39

---
title: Pluralsight
published: true
date: 2018-02-05 08:00:08 UTC
tags: SoftwareDevelopment,c#,development,learning
canonical_url: https://www.funkysi1701.com/posts/pluralsight-epf
---

Earlier this year I signed up for pluralsight. If you want to sign up to pluralsight as well use this link [http://referral.pluralsight.com/mQd8BJ4](http://referral.pluralsight.com/mQd8BJ4) to get money off.

Pluralsight is a website that sells training videos on a wide variety of technical topics. You sign up for a monthly or annual subscription and you can watch over 6000 courses whenever and where ever you like.

I am not a big fan of videos as if I am sat in front of a screen I would rather be building something, however I do spend a lot of time listening to podcasts. So I have decided to convert this time to listening to pluralsight videos.

If we assume that by not seeing the visual portion of the videos you lose out on 75% of the learning (This is just a guesstimate I am not sure what the exact figure is or how you would calculate it). However this is still 25% more learning than if I hadn’t signed up at all.

Since I signed up I have listened to over 27 hours of technical videos. These have covered topics like C#, Security, Xamarin, MVVM, Interfaces, Getting Involved and Clean architecture. The number one thing I have learnt is that there is a lot that I still don’t understand.

[![pluralsight](https://media-exp2.licdn.com/media-proxy/ext?w=180&h=110&f=c&hash=2DICrZGwAwdh4z0KEMF0kWaIcwc%3D&ora=1%2CaFBCTXdkRmpGL2lvQUFBPQ%2CxAVta5g-0R65wVUKzgkz4aKSpEi48AlESo-TA3PiDmbpp4DeJDT2K5aLLufiuwxcPW5UjVJtPfL8FXa0Tsz8fsisYN51i4rlJY3mNlZeSU4uy3lB6w)](http://referral.pluralsight.com/mQd8BJ4)That said I would like to think that since starting to listen to pluralsight concepts have gone from being unknown unknowns (I don’t know about them and I don’t understand them) to known unknowns (I know about them but don’t yet fully understand them)

To keep track of your learning pluralsight has some tests which you can complete. I am particularly proud of my score on the Azure test which ranks me as an expert.

Why not check out what you can learn from pluralsight?
Software Documentation, how can we do better?
Tags: discuss, opensource, webdev
Published: 2018-02-05 07:50:28

---
title: Software Documentation, how can we do better?
published: true
description: Documenting software is hard, keeping it up to date is harder
tags: discuss, oss, webdev,
---

One of the perks I experience from being in front-end development for so long, is that I'm not scared of documentation anymore, no matter how boring it looks. It's easier to get started with new libraries and / or frameworks and I recognize if I actually like doing something way quicker.

It also made me realize that documentation and versioning is really confusing, and apparently quite hard. 

And it's not just software, but even the languages we use. A few years ago, a lot of us never heard about Ecmascript before. Now we're all aware of 'ES' versions like ES6, which also is named as ES2015 and ECMAScript 2015. You might not realize it, but having three names for one thing is confusing for newbies. Hell, it's confusing to me. I just took the fact that ES6 and ECMAScript 2015 are the same thing at face value, but when looking up information the first time I wasn't sure if an article that _exclusively_ talked about ES6 was talking about the same thing as blog post _exclusively_ talking about ECMAScript 2015. (note how I wrote ECMA both capitalized and not, because that's apparently how it works)

If we're talking about frameworks we see that iterations move quickly and the documentation always lags behind. And that's not just the official docs, but also all the blog posts that explain how to do particular stuff in the old methods. I was totally confused finding React examples with `React.component`, `React.createClass` and just simply `extends Component`. It took me a while to figure out what exactly had happened there. 

When talking tooling I came across a good example in BabelJS. I'm currently writing an article about transpiling (or compiling as these words are not the same but are used interchangeable)  so I find it important to get things right. When you look at the Babel site it tells you to install `babel-preset-env`. When you go to the `babel-preset-env` Github page it tells you its deprecated and you should use `@babel/preset-env`. Confused yet?

{% twitter 957784604966031361 %}

Totally understandable.  

Of course we want our software to improve, become better and make some breaking changes every once in a while, but my big question is: How can we make sure that there are not a whole bunch of people ending up confused because they're looking at conflicting documentation? 

I'd suggest that software creators / OSS maintainers should at breaking changes to the official documentation and not just in a changelog. This, of course only works if the official documentation is up to date. 

And as open source users we must not forget we can actively contribute to documentation. In fact, most OSS maintainers would welcome help with documentation a great deal!

I'm hoping to write up a bit more on this matter, so I would love to hear your input on this.

_sorry if anything is unclear, I wrote this before coffee_
Explain the differences and use cases for a Raspberry Pi vs Arduino like I'm five (but smart)
Tags: explainlikeimfive, raspberrypi, arduino, iot
Published: 2018-02-05 01:46:37

---
title: Explain the differences and use cases for a Raspberry Pi vs Arduino like I'm five (but smart)
published: true
description: When to use a Raspberry Pi for a project, and when to use an Arduino.
tags: explainlikeimfive, raspberrypi, arduino, iot
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xtxxsmsfqmfr435ivc2j.jpg
---

I just got Sparkfun's Raspberry Pi 3 starter kit and some extra fundamental components and one fun component (a speaker). I used to do some DIY electronics stuff, but I didn't understand capacitance at the time (to be fair, neither did my high school teacher) or diodes. 

Now I'm obsessed with smart home IoT / home (and everything else) automation and I finally decided to dip my toes in hardware so I can make my own devices. I'm sure there are a bunch of fun sensors and components on the 3 big merchants' websites, so I plan to try a lot more DIY electronics. So, I realized what is an important question if I plan to keep getting into this hobby:

# Main Question!
**What is the difference between Raspberry Pi and Arduino?** Both in terms of *technical details* as well as *use cases* or what the community focuses on.

### Bonus Questions

#### Bonus 1
What about the "AVR" and "ATMega" stuff I vaguely remember from DIY forums? I kind of get the sense that there is a hierarchy going from high level to low level, pi > arduino > AVR/Atmega.

#### Bonus 2
What is the difference between Particle/Blynk/ControlEverything and what are their competitors? (i.e. Particle vs Hologram is one of the few "competitors" I could find, as I don't know what Particle is - a protocol, a framework, ...?

#### Bonus 3
What's the direction to head in if I'm interested in building smart home / automation projects that I would like to connect with Alexa, Siri / iOS / iPhone, macOS, Google Cast Smart TV, Philips Hue, IFTTT/Stringify/Workflow etc, Wemo outlet switch, HomeKit/HomePod (soon), Android tablets, the Smartthings Hub I'm looking at buying, NFC/RFID technology, APIs and messaging queues, other DIY projects I'll make and other IoT consumer devices or "Hub" devices?

#### Bonus 4
Is there some Arduino-like board that will let me code in raw MIPS assembly? It would be a fun throwback to school.

<small>Background info: I'm a software engineer, primary full-stack but also love FP and Haskell and compilers. I can write Python/Node.js/Lua/Processing/scripts whatever that these projects would require, and know HTTP and RabbitMQ and learning gRPC. So although I'm asking about higher level abstractions, much of the automation I do on my heavily customized mac and smart home setup are node scripts running on a vps (for now).</small>
Hitting a motivation block, how to get over it?
Tags: discuss, motivation, selfhelp
Published: 2018-02-05 01:42:02

---
title: Hitting a motivation block, how to get over it?
published: true
tags: discuss,motivation,selfhelp
---

I’ve hit it. The blocker. I’ve got all these ideas, but I’ve got no motivation to complete them; I start but never finish. It’s quite daunting.

How do you get over this hump and get back to building software with motivation?
Explain The New React Context API Like I'm Five
Tags: explainlikeimfive, react, javascript, webdev
Published: 2018-02-04 23:08:04

---
title: Explain The New React Context API Like I'm Five
published: true
tags: explainlikeimfive, react, javascript, webdev
---

Recently React got [a new version of Context](https://github.com/reactjs/rfcs/pull/2) and I've seen a lot of hype about it in Twitter but I'm not sure if I understand the use case of Context, or why this is a needed change. Can anyone help me understand how it works/what it solves?

Thank you!
Keeping the footer at the bottom with CSS Flexbox
Tags: css, footer, flexbox
Published: 2018-02-04 22:13:37

---
title: Keeping the footer at the bottom with CSS Flexbox
published: true
description: 
tags: css, footer, flexbox
---

Just now I've read the post [Keeping the Footer at the Bottom with CSS-Grid][1]. 
While reading, I somehow got the impression that doing the same with 'just' flexbox is difficult. It's not.

This is not to belittle the referenced post in any way, it is very well explained, and in my opinion more elegant than with flexbox. I just want to explain that it is as easy with flexbox as it is with grid, so that if, for whatever reason, you cannot use grid, you don't shy away from implementing it with flexbox.

I'll use the same HTML as in the referenced article:

```
<html>
    <body>
        <article>
            <header>
            </header>
            <main>
            </main>
            <footer>
            </footer>
        </article>
    </body>
</html>
```

And here the CSS to put the footer at the bottom, where it belongs:

```
html, body {
	width: 100%;
	height: 100%;
}

article {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

main {
	flex-grow: 1;
}

header, main, footer {
	flex-shrink: 0;
}

```

On the container, we set flexbox to align the contents in a column. The elements should stretch so that they span the whole width, and not just the width their contents take up.

Setting `flex-grow: 1` on main makes it grow to fill the available space. This puts the footer at the bottom, since `main` takes up all the space in the middle.

The use for `flex-shrink: 0` is probably less obvious, and it is often forgotten. At least I forgot it way more often than I'd like to admit.  

By default, `flex-shrink` is set to `1`. This makes the items shrink if there is not enough space, which happens if the content is larger than the screen. The results can look very weird, e.g. a button that is smaller than the text it contains. Setting it to `0` stops that behavior. 

That's it. That's everything you need to know to position the footer at the bottom with flexbox. :)



[1]:https://dev.to/niorad/keeping-the-footer-at-the-bottom-with-css-grid-15mf

---

Follow me on [Twitter](https://twitter.com/Domysee) for more of my thoughts, articles, projects and work.
Recomandation For Web Scrapping With Php
Tags: scrapping, php
Published: 2018-02-04 19:20:55

---
title: Recomandation For Web Scrapping With Php
published: true
description: I looking for bestest way to learn how scrapping like a Pro Books or Pdf
tags: Scrapping , Php
---


Hi , looking for recommenadation to learn from 0 to pro level how to scrape, i prefer to do with any library or framework in Php, Thanks!

https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=php+scraping&rh=i%3Aaps%2Ck%3Aphp+scraping take a look here , I'm opened for every suggestion.
How I got started with Open-Source 🎉
Tags: opensource, beginners
Published: 2018-02-04 18:16:13

---
title: How I got started with Open-Source 🎉
published: true
description: A quick-start guide for beginners to get started with Open-Source
tags: opensource, beginners
---

_TLDR: I started with documentation instead of waiting for some big idea to get started._

As most developers, I have also been wanting to get started with Open-Source for almost two years with no progress. I went through all star Open-Source GitHub accounts like [Sindre Sorhus](https://github.com/sindresorhus), browsed through all the tweets and Twitter handles of great developers but was never able to figure out where to get started.

Then one day I saw this [git-flight-rules](https://github.com/k88hudson/git-flight-rules) repo featured in GitHub explore of the week newsletter email. The repo seemed pretty new and it was around the same time when I was exploring a lot on how to use git effectively to improve productivity. The repo is a curation of frequently used git commands in the form of documentation. 

It started as _'Why not? Let's add what we learned to that repo'_.

I forked the repo and added a few topics on using `git stash` effectively and created a PR (Pull Request). The repo maintainer accepted the PR and sent a note of thanks for the contribution. The sense of satisfaction I got after that couldn't be put into words. I made a few more commits in the following days, and a few weeks later I became one of the **top 5 contributors** to the repo. The repo now has over **19k stars** and **1k forks** in GitHub.

So if you want to get started with Open-Source
- Don't wait for the perfect opportunity. Just pick something from your knowledge base and get started.
- What you contribute to doesn't matter as long as you get a sense of satisfaction in doing it. It doesn't necessarily have to be a ground-breaking ML algorithm, it can be as simple as a curated set of git commands too.
- Follow the GitHub explore of the week newsletter to keep tabs on interesting repos. 

Since then I have contributed to a few repos and have three npm packages under my belt. I'll be writing about the npm packages in the following posts.
Open source tools and work proxies
Tags: work, tools, web
Published: 2018-09-05 21:24:22

---
title: Open source tools and work proxies
published: true
tags: work,tools,web
canonical_url: https://booyaa.wtf/2018/open-source-tools-and-work-proxies
---

I often use a lot of open source tooling at work, initially I started with with node and npm (for our front end), and more recently python, Go and of course Rust.

Unfortunately a lot of tools, expect you to have direct access to the Internet, if you're behind a work proxy most will fail to connect to their registries or pull down code from source control repositories.

To make matters worse, work proxies often require Windows authentication. So rather than stick your credentials in a plain text file, you might prefer to use something like [Fiddler](https://www.telerik.com/fiddler). Fiddler is an excellent diagnostics tool for troubleshooting web apps, a bonus feature is that it also provides a local proxy (usually listen on port 8888), using your existing browser proxy settings.

After that, it's just a case of configuring your tools to use this local proxy. Just be mindful that if you can't access websites like [GitHub](https://github.com/) or [npm](https://www.npmjs.com/) in your browser, you won't magically get access this way, those restrictions will remain in place.

Here's a list of ways to get your open source tool to work with this local proxy:

## Environment variables (env vars)

Have these setup as a minimum, most tools will look of these env vars and should start working.

```
HTTP_PROXY=http://127.0.0.1:8888
HTTPS_PROXY=http://127.0.0.1:8888
```

This works with [rustup](https://rustup.rs),

## npm

```
npm config set proxy http://127.0.0.1:8888
npm config set https-proxy http://127.0.0.1:8888
```

## cargo

edit `%USERPROFILE%\.cargo` and add the following:

```
[http]
proxy = "http://127.0.0.1:8888"
```

## git

```
git config --global http.proxy http://127.0.0.1:8888
```

This should fix problems with golang and possibly cargo (when pull dependencies).

## python (Anaconda)

edit `%USERPROFILE%\.condarc` and add the following:

```
channels:
- defaults

# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True

proxy_servers:
    http: http://127.0.0.1:8888
    https: http://127.0.0.1:8888
```

## vscode

edit your user settings file and add

```json
  "http.proxy": "http://127.0.0.1:8888",
  "http.proxyStrictSSL": false,
```
Piping JavaScript
Tags: coding, javascript
Published: 2018-02-04 16:14:13

---
title: Piping JavaScript
published: true
description: The new pipeline operator.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ug6sseqfc0x5isxsygcz.jpg
tags: coding, javascript
---

_[Cover image by arbyreed on Flickr.](https://www.flickr.com/photos/19779889@N00/)_

JavaScript is getting more and more functional programming features, an exiting one is the new [pipeline operator](https://github.com/tc39/proposal-pipeline-operator).

The operator is `stage-1` so it won't be included in the standard right away, but you can already use it with the help of [babel](https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-pipeline-operator).

## Why

If you come from an object oriented background, you probably used the dot operator quite alot. Many libraries use it to implement small DSLs, often called fluent interfaces, that help you to get things done with good readability.

For example [Moment.js](https://momentjs.com/)

```javascript
moment().add(2, "days").substract(10, "hours").toString();
```

An functional alternative is [date-fns/fp](https://github.com/date-fns/date-fns/blob/master/docs/fp.md), but as you can see, the nested function calls make it a bit hard to read.

```javascript
format("D MMMM YYYY", subHours(10, addDays(2, new Date())));
```


Now wouldn't it be nice, to have this kind of left-to-right readability for functional code too?

## What

This is where the new piping operator comes in handy, it allows you to make this kind of code more readable.

```javascript
f(10);
```

becomes

```javascript
10 |> f;
```

So the `date-fns/fp` example from above becomes

```javascript
const add2Days = addDays(2);
const sub10Hours = subHours(10);
const customFormat = format("D MMMM YYYY");

new Date() |> add2Days |> sub10Hours |> customFormat;
```

or in short:

```javascript
new Date()
|> addDays(2)
|> subHours(10)
|> format("D MMMM YYYY");
```

As you can see, the operator requires a function that only needs _one argument_. The `date-fns/fp` functions return such functions, when only called with one argument.

This also works with asynchronous functions, because they are build on top of promises, which return _one result_.

```javascript
"USERID_123"
|> await loadUserFromApi // async
|> extractUserImageUrl   // sync
|> await cropUserImage;  // async
```

## Conclusion

Again, JavaScript takes a step into the FP direction and build on top of the additions it already had. Especially server-side data-transformation code will profit from code written this way.
How to temporarily store API response?
Tags: discuss, googleapi
Published: 2018-02-04 14:32:42

---
title: How to temporarily store API response?
published: true
tags: discuss, google-api
---

I'm currently working on a Laravel based application that lets users access their Google drive and have all of their files listed on our front-end.


My question is, how do I temporarily store this API data so that even if user refreshes the page, s/he doesn't have to repeat the google consent screen step all over again, and the data can be shown to the user?

I read couple posts regarding this, though I got confused among different technologies that can be leveraged to achieve this. Techs like `Redis`, `Varnish`, `HTML5 storage`, and most importantly `Nginx caching gateway`.

Can you shed some light? Thanks