teleren/devto huggingface dataset:
How to replace an org-mode link by its description
Tags: emacs, orgmode, lisp
Published: 2021-02-23 10:24:02


# Table of Contents

1.  [Problem](#org3835595)
2.  [Solution](#orgd509c76)
3.  [Epilogue](#org265a8a6)

<a id="org3835595"></a>

# Problem

Before turning a note into a blog post, I want to remove some of the org-mode links that are internal to my notes. There did not appear to be a way to do this out of the box. The answers I found [on emacs stackexchange](https://emacs.stackexchange.com/questions/10707/in-org-mode-how-to-remove-a-link) used regular expressions or deleted a space after the link.

I used a fair number of tabs to cobble up a solution, so I thought it would be worth sharing.

`org-delete-link` by a throw-away account almost worked, and uses org-modes&rsquo; Abstract Syntax Three through the org-element api. [User Timm](https://emacs.stackexchange.com/users/12336/timm) correctly pointed out a space after the link would also be deleted.

<a id="orgd509c76"></a>

# Solution

I prefer [Andrew Swann](https://emacs.stackexchange.com/users/2710/andrew-swann)&rsquo;s name for the function, so here is my fixed mashup:

``` emacs-lisp
    (defun org-replace-link-by-link-description ()
      "Remove the link part of an org-mode link at point and keep
    only the description"
      (interactive)
      (let ((elem (org-element-context)))
        (if (eq (car elem) 'link)
            (let* ((content-begin (org-element-property :contents-begin elem))
                   (content-end  (org-element-property :contents-end elem))
                   (link-begin (org-element-property :begin elem))
                   (link-end (org-element-property :end elem)))
              (if (and content-begin content-end)
                  (let ((content (buffer-substring-no-properties content-begin content-end)))
                    (delete-region link-begin (- link-end 1))
                    (insert content)))))))
```

Subtract one from link-end and it works. This is the fixed line:

```emacs-lisp 
    (delete-region link-begin (- link-end 1))
```

Original question on emacs stackexchange: [in org-mode, how to remove a link?](https://emacs.stackexchange.com/questions/10707/in-org-mode-how-to-remove-a-link)


<a id="org265a8a6"></a>

# Epilogue

Why do I want this? I want to publish only some of my org-roam notes. Org-roam notes are like private wiki-pages. It also allows (with a bookmarklet) to clip webpages to their own org-roam note. At the top of the note, there is a roam<sub>key</sub> that then contains the url of the page. I want to export my org-roam notes to markdown. Links should be to orignal webpages, instead of my private clippings with notes.

This is a baby step in the right direction.

FYI  macs is perfectly usable without writing any code, using a distribution like Doom Emacs (my current) or Spacemacs (my previous). This is the first time in six years of regular emacs use that I&rsquo;m writing a non-trivial amount of code for it.
Making technology more accessible and inclusive through the power of language
Tags: a11y, microsoft, ai, azure
Published: 2021-02-23 10:16:05

Microsoft has added, in public preview, [Optical Character Recognition](https://azure.microsoft.com/en-gb/updates/computer-vision-read-ocr-languages-update-preview/?WT.mc_id=java-00000-ropreddy) (OCR) support for two of South Africa’s official languages, Afrikaans and Zulu. “Adding support for these languages is part of Microsoft’s mission to build meaningful cognitive products and services that improve local engagement,” says Rory Preddy, Senior Cloud Advocate at Microsoft South Africa.

“This support, which now counts a total of 73 languages, means that more people are able to connect in their own language and that language will become a seamless feature of using technology, rather than a hindrance.”

OCR support for local languages, allows users to use visual data processing to label content with objects and concepts, extract text, generate image descriptions and moderate content. It currently provides text and handwriting recognition. “The next step is to also understand different dialects within the languages supported in order to enable speech support,” says Preddy. 

“OCR support for various languages further opens up doors to connect people with technology in their own language and use language as a critical differentiator for cognitive services and products that are able to change and improve everyday life by making the world more accessible and inclusive,” says Preddy. 

This understanding of the essential role of cognitive tools, encourages Microsoft’s Azure Cognitive Services team to create and develop AI tools and solutions that make a tangible difference. “These solutions aim to level the playing field to ultimately empower individuals and organisations to do and achieve more,” says Preddy.
How To Rank In The ‘People Also Ask’ Boxes in SERPs? - eGoodMedia 
Published: 2021-02-23 09:28:26

The ‘People Also Ask’ boxes are introduced to provide search engine users with a more reinforced form of results, where they could easily figure out other websites with related information. Visitors obviously don’t rely on a single piece of information, especially when going to buy an expensive product. This way, you can provide them a more reliable form of information, if you’ve got a fine content writing skill. And, the ‘People Also Ask’ box will essentially support you on this. 

With this article, we want to educate many aspiring web developers & internet marketers like you about the meaning and importance of the ‘People Also Ask’ box.

<a href="https://www.egoodmedia.com/how-to-rank-in-the-people-also-ask-boxes-in-serps/">Read more</a>

Read more Articles:-
<a href="https://www.egoodmedia.com/8-ways-to-convert-unlinked-brand-mentions-into-backlinks/">8 Ways to Convert Unlinked Brand Mentions Into Backlinks</a>
<a href="https://www.egoodmedia.com/how-crucial-is-seo-for-your-ecommerce-business-these-days/">How Crucial Is SEO For Your eCommerce Business These Days?</a>

Contact Details:-
1-6046704333
422 Richards St Unit 170, Vancouver, BC V6B 2Z4, Canada

<a href="https://www.egoodmedia.com/">Web Design Seattle Company</a>

Visit Reference Profile Websites:-

http://bit.ly/2ZDXwwF
https://bit.ly/3uoa759
http://bit.ly/3aGuaE6
http://bit.ly/3qMd6Ce
http://bit.ly/3dzZKoV
http://bit.ly/3sjp3Qi
http://bit.ly/3kfqD2T
http://bit.ly/2ZJMups
http://bit.ly/3kfJXNf
http://bit.ly/3aHE8VN
http://bit.ly/3pOeDX0
http://bit.ly/3sh7GPW
https://bit.ly/2P4EgGw
http://bit.ly/3pvCTNu
http://bit.ly/3dzZKoV
http://bit.ly/3kfJXNf
http://bit.ly/2Zriezx
http://bit.ly/3avgDiI
http://bit.ly/3qvKhK1
http://bit.ly/3dsaeGL
http://bit.ly/3pzVA2C
http://bit.ly/3dpqdpc
http://bit.ly/3arqTs5
http://bit.ly/2M0jmai
Common Gateway Interface in Web Authoring
Tags: webdev, html
Published: 2021-02-23 09:27:42

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2dfepp1nwk5kdt54msp.jpeg) {% medium https://medium.com/@joelmulongo97/common-gateway-interface-in-web-authoring-e7e77e80501a %}
Top Amazing Benefits of Magento Ecommerce Development
Tags: webdev, mobile, android, devops
Published: 2021-02-23 09:24:06

Retailers and startup owners are enthusiastic about bringing their business online. Whether you say it an impact of a pandemic or a growing competition in the brick-and-mortar business, eCommerce development strives at a rapid pace worldwide. These days, advancing technology has made it possible to build a robust eCommerce website or an online store with desired features using the most suitable development platform.

Out of several eCommerce development platforms available these days, Magento has gained ground in a very short span of time. We can consider its amazing features and excellent functionality as the major reasons for its growing popularity among developers and online business owners alike. Here we make a list of the top ten advantages of [Magento eCommerce development](https://www.suriainternational.com/magento-website-design-company/) for your online business.

Top Advantages of Magento Development for Your Business

    Robust and Reliable Platform

Your online store needs to be flexible and scalable enough to accommodate new arrivals and handle many visitors at once. Magento, as a powerful eCommerce platform, can easily meet these requirements. It is fair to mention that Magento is the only platform that can store and manage hundreds of thousands of products simultaneously. Its latest version Magento 2 is ready to meet the diverse requirements and challenges of the eCommerce sector with advanced features and awesome functionality.

    Quick Loading

Even if your online store has an appealing interface and variety of products, visitors tend to switch to other websites if it takes more than 2 seconds to load. PLT (Page Load Time) is one of the most crucial factors to consider for ensuring the website’s success. A study has confirmed that 50% of users leave the sites with a load time of over 2 seconds. Here, the Magento eCommerce platform lends a helping hand. You can get an online store with faster load pages through Magento. It directly leads to a significant increase in the number of visitors and sales.

    Flexible Content Management

This is another advantage of Magento. As an eCommerce website owner, you need to update the content to attract and retain customers to your online store. What’s more, it is beneficial to highlight special offers and promotional schemes on your website at regular intervals. Here, the flexible content system of Magento remains helpful along with an intuitive page editor WYSIWYG (What You See Is What You Get). This built-in feature is useful for manipulating the functioning of the shopping cart and edit eCommerce web pages with ease.

Read More: https://www.suriainternational.com/benefits-of-magento-ecommerce-development/
Neat Routes in Laravel!
Tags: laravel, php
Published: 2021-02-23 09:07:37

##What is the Problem?
One of the programmer's concerns is refactoring.
Refactoring allows us to improve our code knowledge and code quality.

If have been familiar with the Laravel Routing system you know there are some files in `routes/` directory which contain some routes for our project,`api.php` and `web.php` are more useful than other files.

When your project will grow up manage and edit these files are very harmful :(.

Imagine we have a blog project which has a dashboard and admin panel and a home page for everybody.

If we want to make these routes in `web.php` file after a while we will have an unreadable file and we didn't pay attention to the first principle of SOLID which tells us to "A class should have only one reason to change".

##So what should We do?
### How routes will be registerd?
If you check out the `app/Providers/` directory you will see a file called `RouteServiceProvider.php` which contains our routes and it will register our route files.

In the `boot` method we have something like that:

```php

$this->routes(function () {
    // It will register web.php route with 'web' middleware
    Route::middleware('web')
        ->group(base_path('routes/web.php'));
    
    
    // It will register api.php route with 'api' middleware and 'api' prefix
    Route::prefix('api')
        ->middleware('api')
        ->group(base_path('routes/api.php'));
});

```

With the Route facade, we will be able to register our routes in different files.

So let's do that, let's register our routes.

1- Register Home Route:
We don't need to use middleware or a special prefix for this route, so register this in `web.php`:

```php
Route::get('/', [HomeController::class, 'index']);
```
2- Register dashboard Routes:
First, we have to create a new file in the routes directory called `dashboard.php` which contains our dashboard routes:
```php
Route::get('/', [DashboardController::class, 'index']);

Route::get('/edit', [DashboardController::class, 'showEdit']);
Route::post('/edit', [DashboardController::class, 'storeData']);
```

Then we must register this file in our service provider with a `/dashboard` prefix and `auth` middleware.
Open the `RouteServiceProvider.php` and `boot` method, write some codes like this below:
```php

$this->routes(function () {
    Route::middleware('web')
        ->group(base_path('routes/web.php'));
    
   // It will register dasboard.php route with 'api' and 'auth' middleware and 'dashboard' prefix
    Route::middleware(['web', 'auth'])
        ->prefix('dashboard')
        ->group(base_path('routes/dasboard.php'));

    Route::prefix('api')
        ->middleware('api')
        ->group(base_path('routes/api.php'));
});

```
Congrats! we registered our first route file :)

You can make more changes based on your project.

`Point: This syntax belongs to Laravel 8 and in the previous versions we had some differences, but the scenario has not changed.`
How do I set the release mode (e.g. "debug", "release") for a CSharp file in `X.csproj`
Tags: csharp, beginners, help, janky
Published: 2021-02-23 08:55:59

We're getting ever closer to the release of the new and improved Janky in CSharp. However, I face a new challenge, I'm using CLI tools to do building, and a lot of the tutorials I find when searching are for VSCode building.
Since I'm not using VSCode, I was wondering if there is some option in `X.csproj` (`language.csproj`) that would let me achieve this.

Currently, I'm using the default `csproj` file, since it's in XML (ewwwwww.... (any alternatives to the XML format?)), and I don't know what any of the tags do.
This is currently what it looks like:
```xml
<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net5.0</TargetFramework>
		<OutputType>Exe</OutputType>
	</PropertyGroup>
</Project>
```


<div alt="Thanks! Cheers">
##<b><center><b>Thanks!<br/>Cheers!</b></center></b>
</div>
New in Chrome DevTools
Tags: tutorial, webdev, css, productivity
Published: 2021-02-23 08:33:02

You can now copy CSS properties faster. Right-click on a CSS class to copy the current selector name, the full rule or all declarations under the rule. See on image. 

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2yii4sa3vc9lrau9qmbt.png)
 
If you are using the Chrome Dev version you can test this out.  I must say, finally.
Get help automating your releases
Tags: javascript, beginners, python, go
Published: 2021-02-23 08:17:30

---
title: Get help automating your releases
published: true
description: Changie is a changelog tool that automates your changelog but can also be used as a part of your automated release pipeline. I am offering to help automate releases for projects to help harden Changie as a tool and projects along the way.
tags: javascript, beginners, python, go
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2ov2o63j4deyowi2iqc.jpg
series: Changie
---

Recently I posted an [article](https://dev.to/miniscruff/changie-automated-changelog-tool-11ed) about my side project [Changie](https://changie.dev) which automates changelog management. Currently, the only project using Changie is itself, which is kinda funny.

Changie is only one piece of release automation that, I think, every project should have. But, if you are new or just a little inexperienced with release processes this can be a little overwhelming. So, I plan on offering some of my spare time to help other projects automate releases, including Changelogs. Ideally of course using Changie, but if your project doesn't fit within Changie's scope then I understand.

> Note that the release automation is separate from automated tests, linting, and build checks but those are still very important.

So if you have a project that has the following criteria you can reach me below, on Twitter [@miniScruffDev](https://twitter.com/miniScruffDev), or as a discussion post on [GitHub](https://github.com/miniscruff/changie/discussions).
* Project is open source
* Project has been updated sort of recently, at least in the last few months
* You would like to create or automate your changelog
* You would like to automate your releases
* The project is written in Go, Python, or Javascript/Typescript ( As I only currently have experience publishing on PyPI/NPM, and Go has no package repository )
* You of course would need to use Changie

Not sure exactly how well this will go, maybe only a few people may be a lot so will see how it goes. Of course, if you want help but maybe don't fit all the requirements you can still ask.

How exactly I help could range from a simple pull request to private help, or a Zoom call, whatever fits best.
Rollup dts file using TSUP
Tags: tsup, typescript, bundle, javascript
Published: 2021-02-23 08:03:22

---
title: Rollup dts file using TSUP
published: true
description: The fastest way to bundle your TypeScript library
tags: 
- tsup
- typescript
- bundle
- javascript
//cover_image: https://direct_url_to_image.jpg
---

I just improved dts generation in [TSUP](https://github.com/egoist/tsup), a library to help you bundle TypeScript libraries real fast, previously you can use `--dts` flag to rollup `.d.ts` files, but third-party types are not resolved, for example, I often import some type utilities from the `ts-essentials` library:

```ts
// index.ts
import type { MarkRequired } from 'ts-essentials'

export type Options = { foo?: string }

export type NewOptions = MarkRequired<Options, 'foo'>

export const myLib = (options: Options): NewOptions => {
  return { ...options, foo: options.foo || 'default value' }
}
```

If you run `tsup index.ts --dts`, the output `dist/index.d.ts` will look like:

```ts
import { MarkRequired } from 'ts-essentials';

declare type Options = {
    foo?: string;
};
declare type NewOptions = MarkRequired<Options, 'foo'>;
declare const myLib: (options: Options) => NewOptions;

export { NewOptions, Options, myLib };
```

The library `ts-essentials` only provide types, so if you add it as one of the `dependencies` in `package.json` every user would have to install the whole package, even if only a single type is imported, and some people don't even use TypeScript.
 
## Resolve external types

tsup provides a solution, which allows you to resolve and rollup external types so everything[^1] results in a single `.d.ts` file, run `tsup index.ts --dts-resolve` and the new `dist/index.d.ts` would be:

```ts
/** Mark some properties as required, leaving others unchanged */
declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;

declare type Options = {
    foo?: string;
};
declare type NewOptions = MarkRequired<Options, 'foo'>;
declare const myLib: (options: Options) => NewOptions;

export { NewOptions, Options, myLib };
```

No additional package now! 🥳

---

Know more about TSUP:

- GitHub: https://github.com/egoist/tsup
- Documentation: https://tsup.egoist.sh

[^1]: `--dts-resolve` will ignore packages specified in the `dependencies` field in `package.json`, meaning they're always externalized.
Rails TIP: Use dom_id to Generate Ids in HTML
Tags: ruby, rails, beginners
Published: 2021-07-20 18:21:59

---
title: Rails TIP: Use dom_id to Generate Ids in HTML
published: true
date: 2021-02-23 00:00:00 UTC
tags: ruby,rails,beginners
description: How to use dom_id in Rails to tidy up your views.
canonical_url: https://williamkennedy.ninja/rails/2021/02/23/use-dom-id-to-clean-up-views/
---

![alt text](https://williamkennedy.ninja/assets/images/posts/html.jpg "All powerful but very simple HTML")Photo by [Pankaj Patel](https://unsplash.com/@pankajpatel?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/html?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)

## Overview

When working with Rails, there’s always a better way to do something.

One of my favourite discoveries recently is the [dom\_id](https://apidock.com/rails/ActionView/RecordIdentifier/dom_id) helper, which I discovered while learning about [Stimulus Reflex](https://docs.stimulusreflex.com/).

It’s one of those tools that I wish I discovered years ago.

If you’ve written code like below, dom\_id may help you in the future.

```
<% @posts.each do |post| %>
  <p id="index_post_<%= post.id %>"></p>
<% end %>

```

There is nothing wrong here, the issue arises when you have to interact with the dom via Javascript or a background job. Your code ends being a little less dry because you have to remember that you prepended `index_post_<%= post.id %>` every time.

I have come across code like this in a js.erb template.

```
var post = document.querySelector("#index_post_<%= @post.id %>")  

```

And in the background job or service worker, you will also have to remember this format if you plan on using something like [cable ready](https://cableready.stimulusreflex.com/) to update the dom.

Luckily, dom\_id provided a simple way to clean up all that code and make everything DRYer.

## How do you use dom\_id?

As with a lot of view helpers in Rails, using it is straightforward.

### Using it in a view

Let’s imagine we have a Post model.

The dom\_id methods take one argument and one optional argument for a prefix.

```
# without prefix
dom_id(Post.find(2)) # => "post_2”
dom_id(Post.new) # => "new_post”
# with prefix
dom_id(post.find(2)) #=> “post_2”
dom_id(post.find(2), :custom) #=> “custom_post_2” 

```

### Using it from a background job or model

Since dom\_id is baked right into Rails, you can call it from anywhere using ActionView.

```
app/models/post.rb
def dom_id
  ActionView::RecordIdentifier.dom_id(self)
end

```

Happy coding.
Can "good code" be measured?
Tags: discuss, testing
Published: 2021-02-23 07:51:10

I was recently reading [Code Complete](https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670), a really good book on writing better software. Naturally, I had a lot of questions while reading it, but the biggest one that kept coming up was, "Can I measure this?" or "Can I quantify this?"

I'm aware of static code analysers, and the vast improvements they bring, but I don't think they can do most of what the book teaches.

So can we write software that "measures" the quality of our software?
☝️ One thing which has helped me IMMENSELY in learning React...
Tags: react, javascript, codenewbie, webdev
Published: 2021-02-23 07:27:26

For context, I started my coding journey about a year ago: with html, css, javascript -> React 👩🏻‍💻

One thing which has helped me, is working on a SINGLE project, and re-factoring that over time 🔁

This is not to say BREADTH of experience is not important. It is. Do a variety of small projects and learn from many different people 👨‍👩‍👧‍👦

But...

...DEPTH of experience on a single project has helped me immensely! 👍

###This was my progression for learning:

1. **Find a project you like on CodePen** (or similar site). When I started learning vanilla javascript, I found a basic to-do list on CodePen, copied over its html/CSS but deleted all its javascript. Then **practiced re-writing my own**. This way you're not trying to do too many things at once, but are honing in on one area...in this case javascript. 

2. **Improve upon the design**. After I had re-written the javascript, I practiced re-designing the to-do list with my own CSS. Again, deleting what was there and starting that part from scratch and to my own liking.

3. Next I wanted to learn React. So I re-factored the whole application using React **class-based components**. 

4. Then re-factored the whole application again using **functional components** and **React hooks**. 

5. Lastly, I wanted to learn **Styled Components**, so I re-wrote all my CSS classes using a Styled Components approach. 

###This has been incredibly helpful to me, as it allowed me to see how the same functionality could be implemented with different approaches. 

And it really made me appreciate the relationship between vanilla javascript and React as a framework. 

####Using this approach, I started off with a very basic to-do app: 
https://twitter.com/threehourcoffee/status/1225241414667161600

####And turned it into the project I work on now: 
https://llamalife.co/

_(it is a to-do list that lets you add a timer to each and every task)_

Hope this is helpful! Any questions, feel free to ask in the comments.

Image source: [@visualashish](https://twitter.com/visualashish/status/1357502178902986752)