<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Milo</title>
    <description>The latest articles on DEV Community by Milo (@milo123459).</description>
    <link>https://dev.to/milo123459</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F584024%2F009b00e4-ae56-49ee-9347-1adc67781965.png</url>
      <title>DEV Community: Milo</title>
      <link>https://dev.to/milo123459</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/milo123459"/>
    <language>en</language>
    <item>
      <title>Cloning, how does it work?</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Thu, 21 Oct 2021 21:23:01 +0000</pubDate>
      <link>https://dev.to/milo123459/cloning-how-does-it-work-pgo</link>
      <guid>https://dev.to/milo123459/cloning-how-does-it-work-pgo</guid>
      <description>&lt;p&gt;Hey! &lt;br&gt;
Recently, I have been faced with an error. I have a DasHap of a &amp;amp;str and a bool, and I have 2 functions, each in a loop, each in their own thread. I need to share this dashmap between both threads, so I wrapped it in &lt;code&gt;Arc&lt;/code&gt;. I get a borrowing error, of course, and was suggested to clone outside of the thread because the closure is &lt;code&gt;async move&lt;/code&gt;. But, then, if I update the not-cloned value, that won't reflect on the cloned-value, and to update the cloned-value, I have to reference it where the not-cloned value changes, which is in a thread, that would cause borrowing errors.&lt;br&gt;
To sum up, having a value being cloned outside of a loop, requiring the original value to be updated, subsequently also requires the cloned-value to be update, but can't be done as if I update the cloned-value in thread 1, I can't use it in thread 2 because of borrowing errors.&lt;/p&gt;

&lt;p&gt;Any help appreciated!&lt;/p&gt;

</description>
      <category>rust</category>
      <category>help</category>
    </item>
    <item>
      <title>Imagine Git hooks in Rust..</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Sat, 28 Aug 2021 13:20:28 +0000</pubDate>
      <link>https://dev.to/milo123459/imagine-git-hooks-in-rust-3nhd</link>
      <guid>https://dev.to/milo123459/imagine-git-hooks-in-rust-3nhd</guid>
      <description>&lt;p&gt;I'm going to say it.... Git hooks are &lt;em&gt;bad&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Well, not bad, just annoying, and way too much setup. You have to write a bash script, etc, and things like &lt;a href="https://github.com/typicode/husky"&gt;husky&lt;/a&gt; simplify it.. but not enough.&lt;/p&gt;

&lt;p&gt;I wrote something a few months ago called &lt;a href="https://github.com/Milo123459/glitter"&gt;Glitter&lt;/a&gt;, with its sole purpose being a commit message templating system. It works fantastic, but recently I had someone create an issue: &lt;a href="https://dev.toGlitter%20Hooks"&gt;https://github.com/Milo123459/glitter/issues/33&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They basically asked for Git Hooks in Glitter. I'd already implemented a task system (so you could do something like &lt;code&gt;glitter fmt&lt;/code&gt; or &lt;code&gt;glitter cc fmt&lt;/code&gt;) just by using a simple bit of config, but I thought that just like the user suggested, automatically running them before &lt;code&gt;git add .&lt;/code&gt; in the push command.&lt;/p&gt;

&lt;p&gt;Some benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git Hooks can be quite slow&lt;/li&gt;
&lt;li&gt;Git Hooks can sometimes not pick up paths of packages installed with npm&lt;/li&gt;
&lt;li&gt;Simple config, and can be setup in less than 30 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So lets look at something to format our Rust code before we push.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"custom_tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"fmt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"execute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"cargo fmt"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"execute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"cargo clippy --all-features --all-targets"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"fmt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"lint"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;...&lt;/em&gt; is other config. Check out &lt;a href="https://dev.to/milo123459/introducing-glitter-4505"&gt;this post&lt;/a&gt; if you want to know how to initially set it up.&lt;/p&gt;

&lt;p&gt;Right, it's quite a lot to take in, lets break it down.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;custom_tasks&lt;/code&gt; are tasks that we can run, or, alternatively, can be used as hooks. From this example, I can do &lt;code&gt;glitter fmt&lt;/code&gt; (or &lt;code&gt;glitter cc fmt&lt;/code&gt;) and it'll run &lt;code&gt;cargo fmt&lt;/code&gt;. If I ran &lt;code&gt;glitter lint&lt;/code&gt; (or &lt;code&gt;glitter cc lint&lt;/code&gt;) it'll run &lt;code&gt;cargo clippy --all-features --all-targets&lt;/code&gt;, and so on.&lt;/p&gt;

&lt;p&gt;We can then reference these tasks in the &lt;code&gt;hooks&lt;/code&gt; field. This field takes in the name of your tasks and will just run the commands specified in the &lt;code&gt;execute&lt;/code&gt; field.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problems I faced
&lt;/h2&gt;

&lt;p&gt;Things like &lt;code&gt;yarn&lt;/code&gt; (or any NPM package installed with npm globally) wouldn't be picked up in the path. I was able to fix this rather simply by using the crate &lt;a href="https://crates.io/crates/which"&gt;which&lt;/a&gt; which allows me to get a path to an executable (or a shell script) to run to run the cli. This can also sometimes be a bit faster than just running the name of the command (ie, it'll be faster if I provide a path to &lt;code&gt;yarn&lt;/code&gt;, and don't run &lt;code&gt;yarn&lt;/code&gt; itself)&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional info
&lt;/h2&gt;

&lt;p&gt;Hooks will exit and cancel the command if the command fails or it's exit code is not &lt;strong&gt;0&lt;/strong&gt;. It's very simple. &lt;/p&gt;

&lt;p&gt;If you feel this is cool, please leave a star on the &lt;a href="https://github.com/Milo123459/glitter"&gt;repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feature requests can be put in issues on the repo if possible. If you have any questions, you can make a discussion or ask in the comments.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introducing coco</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Thu, 29 Jul 2021 02:49:19 +0000</pubDate>
      <link>https://dev.to/milo123459/introducing-coco-1g90</link>
      <guid>https://dev.to/milo123459/introducing-coco-1g90</guid>
      <description>&lt;p&gt;Hey, &lt;/p&gt;

&lt;p&gt;Recently I have been running a lot of curl scripts, and they get annoying to google, copy and paste into the terminal. I built coco to fix that.&lt;/p&gt;

&lt;p&gt;Coco provides a simple CLI to add scripts with full argument support, so you can make curl requests faster.&lt;/p&gt;

&lt;p&gt;Lets say I want to get someones GitHub contributions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;coco add contributions "https://github-contributions-api.deno.dev/+1.term"```



Now, I can type `coco contributions GITHUB_USERNAME` and that'd template out to `https://github-contributions-api.deno.dev/GITHUB_USERNAME.term`

It's simple but does the trick. I plan to add more features that get suggested.

If you want to star the repo, here is the link. https://git.io/coco

Thanks, and, hope coco helps you out somehow.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Svelte &amp; vscode &amp; typescript odd error</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Tue, 18 May 2021 12:33:25 +0000</pubDate>
      <link>https://dev.to/milo123459/svelte-vscode-typescript-odd-error-4o89</link>
      <guid>https://dev.to/milo123459/svelte-vscode-typescript-odd-error-4o89</guid>
      <description>&lt;p&gt;hey, im using svelte for a project and vscode extension, and im using typescript, i have it structered like so: src/webviews/&lt;br&gt;
tsconfig.json&lt;br&gt;
components/Sidebar.svelte&lt;br&gt;
pages/Sidebar.ts&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--InV2KhUu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://salvage.is-inside.me/jTW8vAP2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--InV2KhUu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://salvage.is-inside.me/jTW8vAP2.png" alt=""&gt;&lt;/a&gt; this is the error&lt;br&gt;
not sure how to fix it?&lt;br&gt;
anyone know?&lt;/p&gt;

&lt;p&gt;code: &lt;a href="https://github.com/Milo123459/salt/tree/master/vscode-salt"&gt;https://github.com/Milo123459/salt/tree/master/vscode-salt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please, anything will help! I'm so confused.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Salt - 🚀 Task managment++</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Sun, 16 May 2021 17:44:24 +0000</pubDate>
      <link>https://dev.to/milo123459/salt-task-managment-4m1m</link>
      <guid>https://dev.to/milo123459/salt-task-managment-4m1m</guid>
      <description>&lt;p&gt;For so long, I've been using github issues to keep track of things I need to do. It gets annoying, relying on a server to respond, and waiting a while. Say less my friends, I have a solution!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Milo123459/salt"&gt;salt&lt;/a&gt; - A better way to keep track of tasks. No server, everything is local and can be organized very easily. No more "oh hey that's where it was", more "oh god I have to write code!"&lt;/p&gt;

&lt;p&gt;Jokes aside, salt is an attempt to redefine task management. With a VSCode extension in development, for the ultime experience, and tasks synced with other platforms (wip) you can basically throw away anything else. &lt;/p&gt;

&lt;h2&gt;
  
  
  Concepts
&lt;/h2&gt;

&lt;p&gt;Nodes (not nodejs 🚀)&lt;br&gt;
Tasks&lt;br&gt;
Task status&lt;/p&gt;

&lt;h3&gt;
  
  
  Node
&lt;/h3&gt;

&lt;p&gt;A node is the parent of some tasks, think of it like a tree, where the tree is the node, and the apples are the tasks, all under one big node. &lt;/p&gt;

&lt;h3&gt;
  
  
  Tasks
&lt;/h3&gt;

&lt;p&gt;Something you have to do...&lt;/p&gt;

&lt;h3&gt;
  
  
  Task status
&lt;/h3&gt;

&lt;p&gt;Either checked, or not checked, this allows you to keep track of tasks you have to do!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;p&gt;Why not? A task management system for the CLI is the one thing I've needed for so long, and I spoke to a few friends and they loved the concept and using it as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  How
&lt;/h2&gt;

&lt;p&gt;Rust. The CLI is pure Rust.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# macos
brew tap eternalmoon1234/brew
brew install salt
# windows
scoop bucket add sushi https://github.com/kidonng/sushi
scoop install sushi/salt
# other
curl -fsSL https://raw.githubusercontent.com/Milo123459/salt/master/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading! Suggestions can go in the comments 😉&lt;/p&gt;

</description>
      <category>rust</category>
      <category>cli</category>
      <category>task</category>
    </item>
    <item>
      <title>Introducing: Glitter!</title>
      <dc:creator>Milo</dc:creator>
      <pubDate>Wed, 24 Feb 2021 17:33:25 +0000</pubDate>
      <link>https://dev.to/milo123459/introducing-glitter-4505</link>
      <guid>https://dev.to/milo123459/introducing-glitter-4505</guid>
      <description>&lt;p&gt;Hey folks! I've been hard at work programming my first commercial package. &lt;/p&gt;

&lt;p&gt;This package is called &lt;code&gt;glitter&lt;/code&gt;. A hyper-fast way of executing git commands.&lt;/p&gt;

&lt;p&gt;Currently, glitter is available on Scoop. Install it with &lt;code&gt;scoop install glitter&lt;/code&gt;, or, clone the repo and run &lt;code&gt;cargo install --path .&lt;/code&gt; to install it.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is glitter?
&lt;/h2&gt;

&lt;p&gt;Glitter is the git-companion you've longed for. Fast, efficient, written in Rust and super friendly errors. What more could you need in a friend? 😃&lt;/p&gt;

&lt;h2&gt;
  
  
  But.. how do I use it?
&lt;/h2&gt;

&lt;p&gt;The config lives in a file called a &lt;code&gt;.glitterrc&lt;/code&gt; (this is customisable!) and is a simple JSON structure. See all available keys &lt;a href="https://github.com/Milo123459/glitter/blob/master/docs/index.md"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have a question, please don't hesitate to make a discussion on the &lt;a href="https://github.com/Milo123459/glitter"&gt;repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know of some feedback in the comments, hope you have a great day!&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>rust</category>
    </item>
  </channel>
</rss>
