teleren/devto huggingface dataset:
Vim Tips: Snippets without plugins
Tags: vim, snippets
Published: 2022-03-21 16:08:21

---
title: Vim Tips: Snippets without plugins
published: true
description: Vim snippets without plugins
tags: #vim #snippets
//cover_image: https://direct_url_to_image.jpg
---

There are many Vim plugins to create code snippets. But did you know Vim already supports this functionality?

I like relying on _vanilla_ Vim as much as possible, and keep plugins to a minimum. For that reason, I ended up using `:help abbreviations` to make a simple snippet engine. 

It works so well, I'd like to share it! Below is an example of my current setup:

```vimscript
augroup haml
  autocmd!
  autocmd FileType haml inorea <buffer> 
        \ table %table<CR>%thead<CR>%tr<CR>%th {%header row%}<CR><BS><BS>%tbody<CR>%tr<CR>%td {%body row%}
augroup END
nnoremap <Plug>GoToNextPlaceholder :call search('{%[^%]*%}')<CR>va{
imap <silent> <C-q><C-e> <C-v><C-a><C-]><Esc><Plug>GoToNextPlaceholder
nmap <silent> <C-q><C-q> <Plug>GoToNextPlaceholder
imap <silent> <C-q><C-q> <Esc><Plug>GoToNextPlaceholder
vmap <silent> <C-q><C-q> <Esc><Plug>GoToNextPlaceholder
```

The mappings I use are `<C-q><C-e>` to expand, and `<C-q><C-q>` to go to next placeholder, but feel free to change this to whatever you like.

I define snippets inside an `augroup`, in this case, all HAML snippets are there. Each snippet ends with `ctrl-a`, that's just so snippets don't get automatically triggered all the time, we want to manually trigger them.

You can input the `<ctrl-a>` character while typing by pressing `<ctrl-v><ctrl-a>` in insert mode.

The snippet itself looks like this:

```vimscript
autocmd FileType |my-filetype| inorea <buffer> |my-sippet<c-a>| |my-expansion|
```

You can use `{%placeholders%}` in the expansion, to be navigated with `<C-q><C-q>`. A HAML table snippet looks like this:

```vimscript
autocmd FileType haml inorea <buffer> 
        \ table %table<CR>%thead<CR>%tr<CR>%th {%header row%}<CR><BS><BS>%tbody<CR>%tr<CR>%td {%body row%}
```

Hope you find it useful!

EDIT: If you like this approach, I created an actual plugin [here](https://github.com/gosukiwi/vim-zensnippets) :) It's less than 100 lines of Vimscript, so if you are into minimal, no-dependency plugins, you'll feel right at home.
Install Java on windows 10 in 3 simple steps
Tags: java, codenewbie, guide, help
Published: 2022-03-21 16:03:48

> 
- Step-1 Download JDK-17
- Step-2 Install JDK(Java Development Kit)-17
- Step-3 Set the Environment Path


## Lets get started!

## Step-1 Download JDK-17
JDK stand for Java Development Kit
[Click here]
(https://www.oracle.com/java/technologies/downloads/#jdk17-windows) to download the file.

> Click over the following link
![Official oracle website for downloading Java-17](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qak3pkn3hpxx1xeeiycz.png)
 


## Step-2 Install JDK(Java Development Kit)-17
Install JDK-17 which comes with inbuilt JRE (so don't have to install it separately) 

> Click **_next_** and set your desirable download path.
![Java 17 Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hsricmozcm7nwxaku20i.png)



## Step-3 Set the Environment Path

1.Go to directory where java is installed and copy bin folder path-

> C:\Program Files\Java\jdk-17.0.2\bin
![Bin folder for java](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zdmawjhrdmlfh8hwggc.png)
 

2.Press Windows button on your keyboard and type environment and click on first result

> Environment
![Environment search](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ovh16hu2bj9ln3r9dik.png)

3.Setting new JDK-17 path 
> 

- Double click on path 
![System Path](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ok92twka19y6kkq2hegm.png)
 
> 

- Click on New and paste bin path of jdk-17 and press **OK**
![Copying path in environment ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4irl1jrn0w7wzpkdisk.png)


## And Done! 😇

- **Check if it is successfully Installed**

Open Cmd and type 

> Java --version
 ![Java version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rawzapnado1srgcgxu9o.png)

**_and if not then feel free to comment below_**
Block-chained Domains - Handshake & Decentralized web
Tags: news, webdev, dns
Published: 2022-03-21 16:02:13

[***Handshake***](https://handshake.org/) is a decentralized ***P2P*** (peer-to-peer) networking protocol.

Differently from the classic DNS which relies on the [IANA](https://www.internetsociety.org/ianatimeline/) database, Handshake uses the block chain to keep an immutable collection of addresses.

Handshake is still in beta but growing rapidly among the internet community. 

As of *17 March 2022*, [Namecheap](https://www.namecheap.com/domains/handshake-domains/) is the only major domain reseller that lets you buy a handshake domain, with ease.

Domains can be acquired through the auctioning system at [hsd-dev.org](https://hsd-dev.org/guides/auctions.html).

[Namebase](https://www.namebase.io/) offers an auctioning platform.

Go get your domain!
Release 2.9 rethinking about my goal
Tags: opensource
Published: 2022-03-21 15:58:35

## Which part of Telescope 3.0 do I own?
In the past 2 weeks in telescope, I have been working in Docker, nginx, and oauth. So I guess I'm gonna own those parts. 

## Which existing Issues are part of this? Which new Issues do I need to file in order to properly describe the work? When will those issues be filed?
- [Add full OAuth2 capabilities to SSO service #3088](https://github.com/Seneca-CDOT/telescope/issues/3088), new issue, after adding oauth to Portainer, we found that it's not convenient to create 2 different oauth github app for staging and development, also in the future if we want to secure more route with oauth2-proxy, we will have to create more oauth github app. This issue will solve that, by enabling full OAuth2 capabilities in our SSO.
- [Apply Dockerfile best practices from Snyk recommendations
#1668](https://github.com/Seneca-CDOT/telescope/issues/1668), undergoing, I started to refactoring some Dockerfile already and will keep refactoring the rest for 2.9 release.
- [Refactor all our dockerfile to use our base image. #3278](https://github.com/Seneca-CDOT/telescope/issues/3278), new issue, in [#2803](https://github.com/Seneca-CDOT/telescope/issues/2803) we created a base to be used in all other of dockerfile.
- [Expose supabase studio under nginx #3033
](https://github.com/Seneca-CDOT/telescope/issues/3033) - undergoing, waiting on [#2979](https://github.com/Seneca-CDOT/telescope/issues/2979), once the secret thing is done. I can push my local change into it.
- [See if our nginx configs make any of these common mistakes #3029](https://github.com/Seneca-CDOT/telescope/issues/3029), new issue, this issue for check if we setup our nginx config correctly.

## Who can I depend on for support in development, debugging, testing, and reviews? I can't do this alone.
[@TDDR](https://github.com/TDDR), is our Docker guy, along [@manekenpix](https://github.com/manekenpix), and [@humphd](https://github.com/humphd) who knows most of the telescope part and provide a lot of help.

## What are the risks that I see, which could prevent me from getting this shipped?

I think time is a big issue. With my course load specially PRJ class + job hunting + doing research and preparing the document to be able to work in Canada is starting, my schedule is getting filled quickly. I started 2 different side projects at the beginning of the semester utilizing web3, nextjs, and redux, but had to pause them because not enough time.

## How will I mitigate these risks?

I think to mitigate those risks. It will be great to find more contributors to have an interest in oauth part and docker. Working as a group is much faster than working alone.
ctrl + tab everywhere
Tags: programming, webdev
Published: 2022-03-21 15:56:22

When using the `ctrl` + `tab` shortcut, the default browser setting is to switch tab to the next one in order.

I like it a lot but it's not default in other tools I use a lot as a developer.

# Using `ctrl` + `tab` in Visual Studio Code

In VSCode we'll have to tweak the keyboard shortcuts preferences. I prefer to edit them in JSON by typing `⌘ cmd` + `⇧ shift` + `p`, `Preferences: Open Keyboard Shortcuts (JSON)` and then adding:

```
    {
        "key": "ctrl+tab",
        "command": "workbench.action.nextEditorInGroup"
    },
    {
        "key": "ctrl+shift+tab",
        "command": "workbench.action.previousEditorInGroup"
    }
```

This will allow us to navigate through grouped tabs with our browser shortcuts.

# Using `ctrl` + `tab` in iTerm2

(First never forget to use the `Natural Text Editing` key mapping preset. I don't understand why it's not default)

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1j20yhb1eoklitpjg10.png)
 
To handle `ctrl` + `tab` correctly, you'll have to tweak the "Keys" tab and replace the key bindings we're looking for to switch to `Previous Tab`/`Next Tab`.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bb5bz6stdpqna7ai7nbd.png)
 

Tada we're done with it! :tada:
List of common coding errors using Substrate
Tags: substrate, rust
Published: 2022-03-21 15:51:39

I have started to study Substrate recently, and encountered a lot of simple but not-so-easy to solve errors. So I decided to make a list of them, for future use and for others)

- error[E0432]: unresolved import `pallet`
This is compile error caused by errors in
`pub mod pallet { <fix errors here> }`

- error: failed to download `parity-db v0.2.2`
can be resolved by:
```
cargo update -p parity-db
```
- many errors while building substrate-node-template often can be resolved with 
```
cargo update -p <package causing problem>
```

- error 
```
.iter().map(|x| x.amount).sum();
      the trait `Sum<<T as pallet_*::Config>::Balance>` is not implemented for `&<T as pallet_*::Config>::Balance`
```
can be resolved by using 
```
.fold(T::Balance::default(), |acc, x| acc + x);
``` 
instead of `.sum()` OR if u use custom asset pallet and can make changes in it, adding trait `Sum<Self::Balance>` to Balance let u use `.sum()`
```
/// The units in which we record balances.	
type Balance: Member + Parameter + AtLeast32BitUnsigned + Default + Copy + Sum<Self::Balance>;
```
- error 1002 (in polkadot.js.org/apps/)
1002: Verification Error: Runtime error: Execution failed: ApiError("Could not convert parameter `tx` between node and runtime: Could not decode `Call::MyPallet.0`:\n\tCould not decode `Call::create.3`:\n\t\tNot enough data to fill buffer\n")

This error appears because of wrong types.json - wrong type here: `Call::create.3` - 3rd argument with start from 0 (0,1,2,3)
- error
Myfe - 20/03/22
Tags: devjournal, testing, python, mongodb
Published: 2022-03-21 15:50:51

## Start of an idea

So yesterday I was just casually laying in bed thinking of what to code next, where I had an idea.
So the list I made on what it should have was a bit like the one below:

- A game about life where there’s a town and in the town are houses, shops and colleges
- You can study for degrees
- You can do jobs (part-time or full-time), some require degrees and some don’t 
- You can start your own business 
- You can turn houses into shops
- You can put houses on rent so other players can live in them

But the problem was I always start making projects like these but never end up actually finishing it up because of my commitment issues.
So I decided to make a blog series where I log whatever I do when working on the game, hoping I’ll be more committed to the making the game.


## Name

Then I laid down and thought about a name. I know the name isn’t the first thing your supposed to think about, but I did anyways.
I wanted the name to have something related to money and life and wanted it to sound cool. So I combined money and life to make mife, but Ys are usually cooler than Is, so I changed it to `Myfe`!

## How to make it

I always use Python for games, so I’m going to use Python for this as well. As I use MongoDB as a database for most things, I’m also going to use MongoDB as a database in this project as well.

## Yay
So this marked the starting of a glorious game!
Quickstart: Java command line tool
Tags: java, linux
Published: 2022-03-21 15:50:10

I keep forgetting how to create new projects from scratch, so I like to keep my personal set of [quickstarts](https://github.com/hekonsek?tab=repositories&q=quickstart-&type=&language=&sort=) on GitHub. [Quickstart for Java command line tool](https://github.com/hekonsek/quickstart-java-cli) is a simple implementation of [Grep command](https://en.wikipedia.org/wiki/Grep) implemented as Java fat jar.

Project is pretty feature-complete right now, however here is the short list of the things I'd like to improve:
- add support for command line parsing
- explicitly manage version numbers of all Maven plugins used by the project (compiler plugin, clean plugin, site plugin, etc)
Script to send a WhatsApp message to yourself
Tags: tip, javascript, performance
Published: 2022-03-21 15:45:39

I do not save numbers any more.

You can send a Whatsapp message to a valid **international number** without the need to save a contact. The API link looks like this

`whatsapp://send/?phone=90873737777`

So here is a quick JavaScript, in a quick HTML file:
```html
<script>
    const url =  "whatsapp://send/?phone="; 
    
    function phone() {
        // get number, append, and browse to whatsapp://send/?phone=number
        // PS you can also add "&text=" parameter
        const phone = document.querySelector("#phone");
        let val = phone.value;
        // clean up
        val = val.replace(/[^\d]/gi, '');
        const _phone = url + val;
        document.location.href = _phone;

    }
</script>

<input type="text" id="phone" placeholder="Phone">
<button  onclick="phone()">Send</button>
```

This will open WhatsApp on desktop, or on mobile if it exists, with the phone number as the chat window. **You can actually message yourself**.

Deployed via the beautiful [Surge.sh](https://surge.sh)

**[Try it](https://sekrab.surge.sh/whatsapp.html)**

> PS: I could not find reference for that on WhatsApp Docs website, no idea why. Can you?

### RESOURCES
- [WhatsApp FAQ](https://faq.whatsapp.com/iphone/how-to-link-to-whatsapp-from-a-different-app/?lang=en)
- [Surge Web](https://surge.sh)
- [Shut CSS framework](https://shut.work)
Need Community Support.
Published: 2022-03-21 15:43:38

Hello everyone, I am a blockchain developer, I need community support because for the last 4 months I don't have a job because due to some physical and medical problems. so for bread and butter, I have started writing blogs on medium - just trying to share my knowledge to a community, please follow & support me on medium if you find my blogs good and help me to for increase my views. I will get some 8$/1-1.5k views. please support me until I will get a new job.

Thanks in advance.

My medium profile.
https://medium.com/@pankajsinghrathore9599
Life Quotes and philosophies -Mr. Paul Ishaili.
Tags: devjournal, productivity, career, opensource
Published: 2022-03-21 15:34:22

_Discretion: the quotes and philosophies integrated in the life of Mr. Paul Ishaili C._

---

📕 **When the dark comes, fight through the dark, the light shall definitely shine forth!**

---
📗 **When you get down to the basis of what you believe, the answer to why you believe it is in your life map. Dig, and dig deeper!**
Let mkdir create parents directories
Published: 2022-03-21 15:17:04

I noticed that it is more than a year since the last post, so I thought that a small new content would have been easier to write.
This in particular refers to an extension I wrote some time ago for the `mkdir` system call to make it a bit more proactive :smile:.

90% of the times, I use `mkdir` to create a new folder in the current directory, so the few times I want to create a new folder in a deeper path I always forget to add the `--parent` flag.

```sh
me/blog $ mkdir foo/bin/bar
mkdir: cannot create directory ‘foo/bin/bar’: No such file or directory
```

as the [Man-pages](https://man7.org/linux/man-pages/man1/mkdir.1.html) would tell you, since the parent directory `foo/bin` does not exist, `mkdir` fails to create `bar`, but what if `mkdir` were so kind to tell me just that, and suggests to add the flag on my behalf? :smile:

This is actually somehow easy.

First of all, you need a way to define new functions in your shell. I use **zsh**, but in **bash** would be the same: write a function definition in a file and source it in _.bashrc_ or _.zshrc_.

This comes from my _.zshrc_
```sh
#
# Functions and aliases
#
source ~/.dot/.config/cconf/zsh/functions.zsh
```
What to do for `mkdir`?

1. override it with a custom function :arrow_right: `function mkdir() {}`
2. find the parent directory `mkdir` expects to exist already :arrow_right: `echo $1 | grep -E -q '[\S+/]+'`
3. if it doesn't exist, ask if it must be created or not :arrow_right: `echo "Press ENTER to run mkdir with --parents."`

Ok, point 2 probably requires some explaination, so let's back to the example above

```sh
me/blog $ mkdir foo/bin/bar
```

`bar` is the folder to be created, while `foo/bin/` is the parent.
The `grep` expression above looks for any sequence of substrings ending with slash `/`: `foo/`, `foo/bar/`, etc., but not `bar`, or `foo`, which would be a directory in the _current_ folder.

So putting all these pieces together:
```sh
function mkdir() {
    # extend mkdir with custom features
    # propose adding "--parents" flag.
    echo $1 | grep -E -q '[\S+/]+'
    if [[ $? == 0 && ! -d $1 ]]; then
        # one of the directories in $1 path do not exist
        # suggest adding "--parents" flag.
        echo "# Some parents in $1 do not exist. Press ENTER to run mkdir with --parents."
        read
        command mkdir --parents $@
        echo "# done"
    else
        command mkdir $@
    fi
}
```

Let's try again

```sh
me/blog $ mkdir foo/bin/bar                                                                                    
# Some parents in foo/bin/bar do not exist. Press ENTER to run mkdir with --parents.

# done

me/blog $ tree | grep -e foo -e bar -e bin
├── foo
│   └── bin
│       └── bar
```
Of course in a similar manner you can override `rm` as well (see [here](https://github.com/clobrano/dot/blob/master/.config/cconf/zsh/functions.zsh#L21)).
Useful React tools and resources
Tags: react, javascript, webdev, beginners
Published: 2022-03-21 15:13:44

## [React Studio](https://reactstudio.com/) :
![React Studio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rvk9z3wt279czv1w6h4.png)

React Studio is a visual design tool that allows you to create React Component and app flow based on your design.   

## [React.js Boilerplate](https://www.reactboilerplate.com/) :
![Boilerplate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5sqfowz4khwj7odpjdno.png)

Quick setup for new performance oriented, offline-first, highly scalable React applications.

## [Storybook](https://storybook.js.org/) :
![Storybook](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvzs2pvoys8gvu4sfoek.png)

Storybook is an open source tool for building UI components and pages in isolation. It streamlines UI development, testing, and documentation.

## [React Bits](https://vasanthk.gitbooks.io/react-bits/content/) :
![Bits](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8rr2u0u4yam0jp53mf6a.png)

A compilation of React Patterns, techniques, tips and tricks.

## [WrapPixel](https://www.wrappixel.com/) :
![WrapPixel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4badtw3ghc1inxwz438.png)

WrapPixel provides both free and Premium React, Bootstrap, 
Angular and VueJs Templates.

## [Reactide](https://reactide.io/) :
![Reactide](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fiib7ediw1bib1yg2467.png)

This is a Dedicated IDE for React development with hot module reloading and component visualization. 

## [React Sight](https://www.reactsight.com/) :
![Sight](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1c4l1cb0wfrti8gdi3qg.png)

It will read React's Virtual DOM and render an interactive tree diagram of the components rendered on the page.

## [Bit](https://bit.dev/) :
![Bit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zbsnnu79hv0br2ae4sm.png)

Bit lets you easily build, distribute and collaborate over reusable components across projects and teams.
#66 Days of Data
Tags: python, datascience, 100daysofcode, ankitgupta
Published: 2022-03-21 15:09:12

## **Learning Python**  👨‍💻

D 37 of #66daysofdata 📈

Today I have learnt Python - Arrays & Hash Tables

Checkout 👉 [My #66 Days of Data timeline on Github](https://github.com/mrankitgupta/66DaysOfData)

Say me Hi! 
I'll be glad to connect on 
👇

**Twitter** @ [Mr_AnkitGupta01](https://twitter.com/Mr_AnkitGupta01)

**Github** @ [MrAnkitGupta](https://github.com/mrankitgupta)
Paracetamol.js💊| #82: Explica este código JavaScript
Tags: javascript, spanish, webdev, beginners
Published: 2022-03-21 15:00:24

## **Explica este código JavaScript**

```js
console.log("--- Menú ---");
console.log("té" + ".".repeat(5) + ":" + "$1.50");
console.log("café" + ".".repeat(3.2) + ":" + "$3.75");
console.log("cerveza" + ".".repeat(-1) + ":" + "$5.00");
```

A. 
```js
--- Menú---
té.....:$1.50
café...:$3.75
RangeError: repeat count must be non-negative
```

B. 
```js
--- Menú---
té.....:$1.50
café...:$3.75
cerveza:$5.00
```

C. 
```js
--- Menú---
té.....:$1.50
RangeError: repeat count must be non-decimal numbers
RangeError: repeat count must be non-negative numbers
```

Respuesta en el primer comentario.

---
[Generasi Gigih (Adaptability)]
Published: 2022-03-21 14:55:54

In my first week as a backend engineer student at Generasi Gigih I learned many things, not only technical things but here I also learned about self-development.

I want to share a moment when in softskills class I was asked to think about change but still didn't know how to deal with it and I was asked to use the strategies I had learned in class to solve a problem I was facing.

Of course, to answer that, I have to look at myself more deeply, because at this time I have experienced many changes, one of which is related to consistency.

Consistency what I mean here is being able to keep my rhythm in doing something, because I'm the type of person who is curious about something and tries to figure it out until I understand.

This is good, but it can get bad when I can't contain my curiosity and I can spend hours until I understand, and when my curiosity ends, I get so tired that my curiosity interferes with the time. sleep, and of course it took me a few days to recover.

From the softskills class at Generasi Gigih I started to explain my problem and this went into the wrong way of learning and thinking.

I just realized that the most important thing in learning is to be consistent, a little but often. It is also related to the way of thinking. Where sometimes my mind says when my curiosity arises I have to understand as soon as possible. But this is what makes me feel bored.

Until now I'm still trying to change the way I control my curiosity, and use the principle a little but often.

Hopefully in the future this article will serve as a reminder to me that I have been in a situation like this and how to overcome it.