teleren/devto huggingface dataset:
How to structure your code repository in a Sanity.io project
Tags: webdev, git
Published: 2018-09-05 16:50:43

---
title: How to structure your code repository in a Sanity.io project
published: true
tags: webdev, git
description: You have started a Sanity project and have configured your schemas and published some content to the API. You are now ready to make a frontend, and app, or a service that takes use of it. But how to structure your code?
canonical_url: https://sanity.io/blog/how-to-structure-your-code-repository-in-a-sanity-io-project
cover_image: https://cdn.sanity.io/images/3do82whm/production/fbfc9355af243dade4c7a31182af7dd0ebdaa5c0-2793x500.png
---

You have started a Sanity project and have configured your schemas and published some content to the API. You are now ready to make a frontend, an app, or a service that makes use of it. Even though you can use Sanity.io as a general API for all sorts of things, it makes sense in some cases to keep the Sanity Studio close to those services that make use of it. Moreover, if you think of it, the Studio is just another frontend to your Sanity API.

There are probably many ways to approach this, but the pattern we have seen the most is to structure your project in a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md). In fact, we do it ourselves with the Studio and the many packages that can be used separate from it. Of course, you should consider [pros-and-cons of multi- or monorepos](https://medium.com/@patrickleet/mono-repo-or-multi-repo-why-choose-one-when-you-can-have-both-e9c77bd0c668), but for a typical project with a studio, a frontend web- or app project with perhaps a simple service, we think it makes sense. 

It means that you have version controll over your schemas. Which is a good thing. It also means that you can include the content studio in a Continious Integration flow, integrating it with other apps.


```
project-folder/
├── studio/
│   ├── config/
│   ├── plugins/
│   ├── schemas/
│   ├── static/
│   ├── .gitignore
│   ├── README.md
│   ├── package.json
│   └── sanity.json
├── frontend/
│   ├── components/
│   ├── lib/
│   ├── pages/
│   ├── static/
│   ├── .gitignore
│   ├── README.md
│   └── package.json
├── services/
│   ├── rss-feed/
│   │   ├── .gitignore
│   │   ├── index.js
│   │   ├── package.js
│   │   └── README.md
│   └── README.md
├── .gitignore
└── README.md
```

In this case, dependencies are installed in each separate folder. So you'll have to start the apps and target the folders in your build system. If the project grows and some of your packages is to be published to [npm](https://www.npmjs.com/) or the like, you can use monorepo managing tools like [Lerna](https://github.com/lerna/lerna), to make it easier to keep track of versioning and to bootstrap.

Since we have written Sanity Studio in React, this structure also allows for sharing UI-components, CSS and so on across projects.

[**Still not sure how to structure the code in your project? Join our Slack and ask us!**](https://slack.sanity.io/)
Can I get some name suggestions please? 
Tags: discuss
Published: 2018-09-05 16:40:43

---
title: Can I get some name suggestions please? 
published: true
description: 
tags: discuss 
---

####Intro####
Hey there everyone!

I'm going to start development of a framework for games made with the Unity3D game engine, and I really need a name for it, but I just can't come up with the perfect name myself. Perhaps the DEV community can help me out a bit?

####About the project####
The framework is going to be a modular, lightweight framework to help out developers creating all kind of games. It's not aimed toward a specific genre and it's very flexible/adaptable.

Since the name of the framework will also be the name of the main class of  the framework (And anything that derives from that), I think it's good to make sure that the name is easy to write, easy to remember and also easy to tell it apart from other scripts in a potential project. (If you read it, you know it's the framework and not something else)

####Names I've tried/thought about####
GameWork - I think it's a bit too close to Nvidia's GameWorks
Grame - As in Frame and game, but for some reason I don't like it
Frank - Because it's easy, but I think it doesn't follow the "easy to tell it apart from other scripts in a potential project" rule)

####Conclusion####
So, that's it really. I'm open to any and all suggestions.

Thanks in advance!
How did you choose your career path?
Tags: discuss
Published: 2018-09-05 16:07:30

---
title: How did you choose your career path?
published: true
tags: discuss
---

Over the last year, I have become an Oracle APEX Developer. With that, I have become adept with basic front-end languages, such as HTML, CSS and Javascript, but mainly the use and maintenance of the Oracle database using SQL and PL/SQL.

I enjoy it, but I can already feel the restriction in the career path. I can continue to become an APEX Developer and hope that it continues to take off, or I can go into Database Maintenance which I'll be honest, I have no interest in.

Then there's learning different languages, but I never know what to pick. I like the look of application development, but I also like the fact that I am pretty much full-stack in my current role.

How did you choose your career path and what advice would you give developers that are fairly new in our career?
Introducing our September 2018 sponsors
Tags: meta
Published: 2018-09-05 15:57:15

---
title: Introducing our September 2018 sponsors
published: true
description: Our wonderful sponsors are vital to the health of dev.to and it is great to work with companies contributing so much to the ecosystem.
tags: meta
cover_image: https://thepracticaldev.s3.amazonaws.com/i/iwavymnn38b39vbhq9d6.png
---

Our wonderful sponsors are vital to the health of [dev.to](https://dev.to) and it is great to work with companies contributing so much to the ecosystem.

These three developer platforms are leaders in their space and I urge you to check out their offerings if you have not yet done so. Seriously, take a few minutes right now to poke around their product guides and documentation.

## Digital Ocean

[Digital Ocean](https://try.digitalocean.com/performance/?utm_source=devto&utm_medium=display&utm_campaign=Devto_2018_Brand) is a much-loved cloud computing platform. I'm always impressed by how well-built _and well-documented_ the Digital Ocean core products are. It's easier said than done, and they've been able to stay ahead of the curve.

Digital Ocean has been our longest-running supporter to date, and we're extremely thankful for their consistent support.  We'll be hosting a [Hacktoberfest](https://hacktoberfest.digitalocean.com/) event next month in NYC — stay tuned for more details!

## Twilio

[Twilio](https://www.twilio.com/?utm_source=devto&utm_medium=banner&utm_campaign=summer_awareness_campaign) has been a great friend of ours since early in the [dev.to](/) days. We are users of their APIs, and folks from our team are always excited to get involved in their community initiatives. It's great to have them as a sponsor!

I can personally say that we chose Twilio Video because it made really great use of native peer-to-peer browser technology while also offering Twilio's infrastructure for necessary use cases wrapped in the same API. The docs and examples were well-organized and getting up and running was a synch.

## Qlik Playground

[Qlik Playground](http://playground.qlik.com/?utm_medium=direct_buy&utm_source=devto&utm_campaign=worklogo) is a programming environment that allows you to use, explore, and quickly test apps that use Qlik technology. Qlik is a data analytics platform used in pretty much every industry for ingestion, visualization, and analysis.

Developing against these kinds of products can be burdensome without developer tools like Qlik Playground. It is this tool specifically that has our team eyeing Qlik as a possible solution as we scale [dev.to](/).

***

These organizations are helping us build the best community we can. I urge you to check out their offerings if you are in the market for their services.

Happy coding ❤️
Software Architecture Demystified
Tags: softwarearchitecture, programming, softwaredesign
Published: 2018-09-05 15:51:02

---
title: Software Architecture Demystified
published: true
description: Software architecture reduced to its core.
tags: software architecture, programming, software design
---

*Software architecture* is one of the most difficult technical discussion among fellow developers. Simply because there is no right or wrong answer in most cases. It seems to always depend. What's the best way to architect a client-server application to handle millions of live transactions with zero downtime? Ok, I hope the answer is clear in this case; **it depends**. What I want to discuss in this article is a generalized approach I've recently been using to access software architecture quality. Its all about **namespaces** and **references**. 

Architecture is about **drawing boxes** around code blocks and adding **lines to connect them**. Its quality is determined by those connections. In programming terms, these boxes are typically referred to as namespaces or packages depending on the language in use. Then, of course, we create connectors by adding **references**. When building enterprise level applications, this I have found to be very crucial. *The act of designing namespaces and their corresponding references is what I call software architecture*. 

So how do you draw these lines, you may wonder. I tend to think about it by looking at *what to keep out* with the goal of holding my connectors at minimal. Another characteristic I use is grouping code block by their *anticipated change frequency*. Things that change very frequently are isolated from those that tend to remain stable. Also, those that change for *related reasons* are kept in proximity.  At the end of the day, it all depends but this I highly encourage you to bear in mind.
Explain Middleware Like I'm Five
Tags: explainlikeimfive, middleware, server
Published: 2018-09-05 14:57:20

---
title: Explain Middleware Like I'm Five
published: true
tags: explainlikeimfive, middleware, server
---

I'm trying to wrap my head around **servers** and how to set up one with all the stuff I wanna use on my app.

**Middlewares** keep popping up... I guess it is something that gets loaded by the server in the middle of sth?? Please help!
Diary - 2018.09.05
Tags: productivity, learning, journey, javascript
Published: 2018-09-05 14:50:31

---
title: Diary - 2018.09.05
published: true
tags: productivity, learning, journey, javascript
---

Regex is really great for finding and/or replacing things.

I have files named `my-file-name.js` or `my_file_name.js`
and want to change them to camelCase `myFileName.js`.

```
function toCamelCase(name) {
  // search for "-" or "_" followed by a character and replace it uppercased
  return name.replace(/[-_]([a-z])/gi, (_, char) => char.toUpperCase());
}
```

Explanation:

```
/ => starts the regex
[-_] => - or _
([a-z]) => all lowercase letters, captured in a group
/ => ends the regex
gi => search all occurencies, ignore case 
(_, char) => char.toUpperCase() => _ is the passed in complete match, don't need it;
return the capture group (= the letter after - or _) uppercased
```
How to embed graph in Django for the users
Tags: django, python3, webdev
Published: 2018-09-05 14:48:03


---
title: How to embed graph in Django for the users
published: true
description: 
tags: django, python3, webdev 
---


I want to show a graph(using matplotlib) to the user. In which Django directory should I place my code? 

mysite/

  graph/
     my_matplotlib/
     __init__.py
      my_matplotlib.py
      graphcode.py (basically, the code for the graph)
 


  app/
  views.py
  from my_matplotlib.my_matplotlib import my_func




my_matplotlib.py

def my_func():
    foo = 'bar'
    return foo


I tried this but it's not working.
The Git Aliases That Get Me To Friday
Tags: git, alias, productivity, shell
Published: 2018-09-05 14:38:11

---
title: The Git Aliases That Get Me To Friday
published: true
description: Shortcuts that might be worth it.
tags: git,alias,productivity,shell
---

# The Git Aliases That Get Me To Friday

![alt text](https://thepracticaldev.s3.amazonaws.com/i/j7to6mqn4b52h31fd9tf.png "Git Logo")

In the last few years since switching from SVN to Git, I’ve picked up a few aliases that have helped me streamline my workflow and be all around more productive. After all, the whole point of shortcuts is to make your life easier right? I’d like to share my aliases with you, however unhelpful they may be.

## Branching

```
co = checkout # Shortcut for checkout.
nb = checkout -b # Create a new branch and check it out.
bl = branch -l # List all local branches.
br = branch -r # List all remote branches.
blr = branch -a # Show local and remote branches.
bd = branch -d # Politely ask Git to delete a local branch.
bdf = branch -D # Sternly ask Git to delete a local branch.
```

## Fetching/Syncing/Merging

```
fp = fetch -p # Fetch and prune.
sync = !git pull && git push # Pull then push current branch.
mm = !git fetch -p && git merge origin/master #Merge remote master into the current branch.
```

## Commits
```
cm = commit # Shortcut for commit.
cma = commit -a # Commit all tracked.
cmam = commit -a -m # Commit all tracked with message to follow.
runAway = reset --hard # For when you just want it all to go away.
forgetAbout = rm --cached # Make Git forget about a tracked file.
```
## Utilities
```
alias = config --get-regexp ^alias\\. # List all aliases.
ec = config --global -e # Open .gitconfig in your default editor.
```

I have all of these and maybe more by time you're reading this in a handy [GitHub repo](https://github.com/MegaMattMiller/gitAliases) if you'd like to `[include]` it in your Git config.


I hope these aliases are as useful for you as they are for me.

If you have your own favorite aliases, leave them in the comments below.
Most Popular Development Posts Of The Week (05 September 2018)
Tags: frontend, javascript, opensource, webdev
Published: 2018-09-05 14:57:20

---
title: Most Popular Development Posts Of The Week (05 September 2018)
published: true
tags: frontend,javascript,open-source,webdev
canonical_url: https://medium.com/daily-now/most-popular-development-posts-of-the-week-05-september-2018-a58eef33a2e2
---

![](https://cdn-images-1.medium.com/max/1024/1*7lAKzz1f368KRdhfQgNKYw.jpeg)<figcaption>Just because something doesn’t do what you planned it to do doesn’t mean it’s useless.</figcaption>

- [50 popular JavaScript open-source projects on GitHub in 2018](https://app.dailynow.co/r/c7d08662081b1d00d2a40d71b10ae89a)
- [Essential skills and tools every Javascript developer should master](https://app.dailynow.co/r/1ebea7286c89812eab5aa96904c88d3a)
- [Modern Frontend Developer in 2018](https://app.dailynow.co/r/e20043edf5485384ee7d66c338e7ed4d)
- [The best life hack for 2018 that isn’t on any life hack list](https://app.dailynow.co/r/cec2ddc13f53622de05d1a5aba84fe40)
- [Weather App built in pure javascript](https://app.dailynow.co/r/9a94a7f466d195be49381ebceb6c9622)
- [Bad Habits Developers Should Fix.](https://app.dailynow.co/r/3e9a3e941c0a6fc4f35288fcb0b537dd)
- [My VSCode Setup](https://app.dailynow.co/r/4eab19244ca716caed8f6916d4eddcfa)
- [Could you explain #likeimfive the meaning of these programming languages as humans?](https://app.dailynow.co/r/32a4b9b627deaae28a3fc90044e1cc7c)
- [How I learned React](https://app.dailynow.co/r/7520edb369ee00598dd447c8fc987ae0)
- [Best JavaScript Frameworks, Libraries and Trends](https://app.dailynow.co/r/e6f9326dec06fb6d434667620fceaca0)

***

[_Thanks to Daily_](https://www.dailynow.co/) _developers can focus on code instead of searching for news. Get immediate access to all these posts and much more just by opening a new tab._
Internship abroad, how did you do it?
Tags: help, discuss
Published: 2018-09-05 14:24:28

---
title: Internship abroad, how did you do it?
published: true
description: Have you ever done an internship abroad? What were your experiences?
tags: #help #discuss
---
Me and a friend of mine have to go on an internship next year for our study. We are really looking forward to it, and we are even planning to go abroad. However, we are very interested in your experiences with going on an internship abroad.

Did you ever go abroad for an internship? What were your experiences? Do you recommend to go to a big company (Airbnb, Twitter) or a startup? And do you have any tips to find an internship abroad?

If you want to share your experience of your internship, we would love to hear it!😏
How do you debug?
Tags: discuss, webdev, beginners, productivity
Published: 2018-09-05 12:21:15

---
title: How do you debug?
published: true
description: What is your approach on debugging issues?
tags: discuss, webdev, beginners, productivity
---
![Debugging](https://imgs.xkcd.com/comics/debugging.png)

I have observed 2 broad categories of debugging issues in code bases.

1. *The physicist.* This type of person really carefully reads the code. Doesn't touch anything, doesn't log much. Just reads and tries to make a mental model of what's going on. They will only change code, or step through the code/add breakpoints when they are pretty sure what's wrong.

2. *The electrician.* This type of person likes to probe things. Like an electrician with an electrical tester they comment things, log results and build understanding through experimentation. 

The first group seems to me more analytical and organized in a way. The second group is more intuitive and adventurous in their testing.

Have you observed similar things? How do you approach debugging?
Best way to learn on React Native
Tags: discuss, reactnative, tutorial
Published: 2018-09-05 10:08:56

---
title: Best way to learn on React Native
published: true
description: 
tags: #discuss, #react-native, #tutorial
---

I am new in React and React Native but I'm a JS Developer and already deployed some apps in Ionic platform. I want to study react native because Ionic has a performance issue but Ionic 4 is coming and they said that it has a better performance.

React on the other side has a bigger community and no performance issue. So my question is should I stick to Ionic and wait for Ionic 4 or learn React native? And what are your recommendations in learning react native?

Thank you! :D
Install Aspose.Diagram using NuGet and Create Microsoft Visio Document in Visual Studio
Tags: nuget, visualstudio, visio, diagram
Published: 2018-09-05 10:08:54

---
title: Install Aspose.Diagram using NuGet and Create Microsoft Visio Document in Visual Studio
published: true
description: Install Aspose.Diagram using NuGet and Create Microsoft Visio Document in Visual Studio
tags: #Nuget, #Visual Studio, #Visio, #Diagram
---

Moved To
https://dev.to/asposediagram/install-asposediagram-using-nuget-and-create-microsoft-visio-document-in-visual-studio-5h1
Making the advanced search query with Eloquent-Builder in Laravel
Tags: laravel, php, eloquent, filter
Published: 2018-09-05 09:39:04

---
title: Making the advanced search query with Eloquent-Builder in Laravel
published: true
description: EloquentBuilder Package
tags: #Laravel #PHP #Eloquent #Filter
---

 ![Unsplash @aginsbrook](https://thepracticaldev.s3.amazonaws.com/i/5sk5jabw0966xz30qlwq.jpg)
We needed an advanced search system in the recent project. This system included many filters that required a flexible and scalable search system.
I decided to implement a package for this system that you can see it in the [GitHub](https://github.com/mohammad-fouladgar/eloquent-builder) and use it in your project.



## What's the problem?

The problem is that you will encounter with a set of filters that you must check for a lot of conditions to add to the query.

Writing a lot of terms will surely reduce the readability of your code and slow down the development process.

Also, you can only use the filters and terms in the same scope and they will not be reusable.

## But the Solution
You must **Refactor** your code!

To solve this problem, you need to **Refactor** your code by replacing many of your conditionals with **Polymorphism**.

Click [here](https://sourcemaking.com/refactoring/replace-conditional-with-polymorphism) to learn more about this design pattern.

## Practical Example:
Suppose we want to get the list of the users with the requested parameters as follows:

```sh
http://dev.to/api/users/search?age_more_than=25&gender=male&has_published_post=true
```

The Requested parameter will be as follows:
```php
[ 
  'age_more_than' => '25',
  'gender' => 'male',
  'has_published_post' => 'true',
]
```
In a **common** implementation, following code will be expected:

{% gist https://gist.github.com/mohammad-fouladgar/ddd1564fb4e979f61c34a68a2746245c %}

We check out a condition for each request parameter.

In the future, we will have more parameters that should be checked and applied in the code above that causes us to have a dirty code.

## Use the Eloquent-Builder

After [installing](https://github.com/mohammad-fouladgar/eloquent-builder#installation) the package presented,change your code as follows:

{% gist https://gist.github.com/mohammad-fouladgar/4c37f0cc4a5e7df43f7335c35315412b %}

You just send the **model** and **parameters** to **‘to’** method.Then, you need to define the filter for each parameter that you want to add to the query.

So easy!

## Defining a filter

For example, I’ll implement one of the above example filters. Follow the example below:
{% gist https://gist.github.com/mohammad-fouladgar/d9ea28c6e4088f450a1eef6b71b0f94c %}
For more details check out the [GitHub](https://github.com/mohammad-fouladgar/eloquent-builder) repository.

{% github https://github.com/mohammad-fouladgar/eloquent-builder %}


Good luck and thank you for sharing your valuable time with me.

Happy Coding!
How would You Handle Dirty Code?
Tags: discuss
Published: 2018-09-05 09:14:48

---
title: How would You Handle Dirty Code?
published: true
description: 
tags: #discuss 
---

You may need to handle some code not written from you. Some may be very dirty and make you extremely depressed.

What would you do when you see these code?

* Rewrite
* Skip
* Tell your boss. Some codes are dirty.


If you are leader, what would you do to avoid dirty code?
Getting Started With CSS | Couple Code Therapy
Tags: podcast, beginners, webdev, css
Published: 2018-09-05 07:49:33

---
title: Getting Started With CSS | Couple Code Therapy
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/t3bgbgrihsocegyur7rf.png
description: This is exciting, In Couple Code Therapy Episode Four My Lovely partner Starts using CSS to style some HTML elements
tags: 
    - podcast
    - beginners
    - webdev
    - css
---

Hey Friends!

This is exciting, In Couple Code Therapy [Episode Four](https://anchor.fm/couple-code-therapy/episodes/Getting-Started-with-CSS-e257pc)

My Lovely partner Starts using CSS to style some HTML elements, She was so happy that she can finally make her Website more colorful.

We'll cover :
- How to include CSS in your page
- CSS Selector
- CSS specificities

Check out the [show notes](https://couplecodetherapy.com/therapies/getting-started-with-css) for more details.

Please let us know how we can improve to better teach basic web development

#### About the show: 

Couple Code Therapy! A new twist on learning web development…Where our brave coding expert host, tries to teach his beautiful, lovely, intelligent, and immaculate wife how to update her own website.
It’s learning the basics of web development & coding – without being overwhelmed.