WillsterJohnson
WillsterJohnson
Explore posts from servers
KPCKevin Powell - Community
Created by WillsterJohnson on 6/30/2023 in #os-and-tools
Piping in Bash (`echo "blah" | foo`)
If I'm doing something which isn't terminal-specific I'll always go for TypeScript/JavaScript as they're ususally faster than Python and I'm yet to have a use case which doesn't have an npm package I can leverage, Python is still on the cards for me though despite me not being much of a fan
7 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/30/2023 in #os-and-tools
Piping in Bash (`echo "blah" | foo`)
Usually I can get the behavior I'm looking for through a mix of Copilot, Google, and my own limited knowledge (https://github.com/WJUtils/bash was written almost entirely by Copilot under my instruction) but somehow neither Copilot nor Google were helpful here. I only realised I could use read because after posting this I got to page 6 of Google and said out loud "how the fuck do I read the pipe?" and immediately facepalmed as I realised there's literally a command called "read"
7 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/30/2023 in #os-and-tools
Piping in Bash (`echo "blah" | foo`)
For the archive, here's a snippet which resolves an input from either $1 or piped content. It doesn't have a mechanism for knowing if both are empty, so you'll have to implement that yourself.
function foo() {
# if $1 empty, use the piped content. Else use $1
local input=$1
if [[ -z $input ]]; then
read input
fi
echo "$input"
# do stuff
}
function foo() {
# if $1 empty, use the piped content. Else use $1
local input=$1
if [[ -z $input ]]; then
read input
fi
echo "$input"
# do stuff
}
7 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/30/2023 in #os-and-tools
Piping in Bash (`echo "blah" | foo`)
read You use read for this. Man, I suck at bash
7 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/7/2023 in #os-and-tools
Deleting users in linux
I don't think it was related to this but I had to completely reinstall today due to a boot error 🎉
15 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/7/2023 in #os-and-tools
Deleting users in linux
nope I'm good, this assignment was the only thing on the entire course that's even remotely sysadmin and I'm very content with that
15 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/7/2023 in #os-and-tools
Deleting users in linux
such a headache, the way I use linux either I can do something, or I can sudo do something, and it just works. managing user permissions? I'll stick to JavaScript I think 😂
15 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/7/2023 in #os-and-tools
Deleting users in linux
yeah, simple... It definitely didin't take me three hours to get the users & groups set up along with some file permissions stuff...
15 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 6/7/2023 in #os-and-tools
Deleting users in linux
looking through /etc/groups doesn't reveal anything that looks odd, though there's a lot of stuff in there. Home dirs only shows my stuff
$ ll /home
total 4.0K
drwxr-xr-x 102 will will 4.0K Jun 7 15:10 will/
$ ll /home
total 4.0K
drwxr-xr-x 102 will will 4.0K Jun 7 15:10 will/
the useradd file only contains comments and SHELL=/bin/sh I know it won't hurt if something's left over, and tbh it doesn't matter as I'm (hopefully) getting a new laptop soon, but I wanna clean up at least most of it just to know that I'm not gonna run into anything in time. From the additional checks you mentioned, looks like everything's reverted
15 replies
KPCKevin Powell - Community
Created by b1mind on 2/20/2023 in #resources
Coollabs fonts - replacement for Google font
May as well leave this in here; Here's how you can update your Vite-powered website to use coollabs instead of google fonts (or simply avoid changing your copy-pasted google fonts code). It also upgrades urls to https in case you accidentally included an insecure URL.
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
...,
{
name: "vite-plugin-coollab-transform",
transform: (code) =>
code.replace(/"https?:\/\/fonts.googleapis.com/, '"https://api.fonts.coollabs.io/'),
},
],
});
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
...,
{
name: "vite-plugin-coollab-transform",
transform: (code) =>
code.replace(/"https?:\/\/fonts.googleapis.com/, '"https://api.fonts.coollabs.io/'),
},
],
});
4 replies
KPCKevin Powell - Community
Created by WillsterJohnson on 5/18/2023 in #resources
learn.svelte.dev - Learn Svelte in your browser
If you're new to Svelte, you may find it useful to read the conversation in #general starting from the message linked below to see some common new-to-svelte questions. Big thanks to @joy2op for being an eager learner and asking a lot of good questions! https://discord.com/channels/436251713830125568/448294302053957632/1108713153799393280
2 replies
KPCKevin Powell - Community
Created by thethingisback on 5/9/2023 in #front-end
Uninstalling node, node -v still returns a version number
It will depend on how you installed node to begin with. For example, if you installed node via brew, the correct way to uninstall it will be different than if you installed it via nvm, and that will be different again from if you installed it from source, etc. https://codedamn.com/news/nodejs/how-to-uninstall-node-js#uninstalling_the_nodejs_on_mac This page seems to have pretty comprehensive instructions on how to uninstall node, and a "manual" fallback option if all of the normal methods fail. You can also find out where node is coming from by running which node, it will output a directory which is the location of the nodejs executable.
3 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
let's break down the CSS quickly
.sr-only {
position: absolute;
left: -1000vw;
}
.sr-only {
position: absolute;
left: -1000vw;
}
the absolute position takes the element outside of the normal flow of the document; by using properties like left, right, top, bottom, and inset, we can say something like left: 20px; top: 50px, which tells the browser to always keep this element 20 pixels from the left edge, and 50 pixels from the top edge of the screen. I would recommend opening up codepen and playing around with absolute positioning if you're not already familiar with it. So we know that left: X units means "always make this X units away from the left edge", so when we put a negative value in there, we're placing the element on the opposite side of the left edge; ie, off of the screen. We use a ridiculously large number here because it doesn't cost anything to do so, and it makes absolutely certain that no matter what the user does, it's not gonna show up on screen. the sr-only class is entirely unrelated to bootstrap, though it's possible that they will have implemented it or something similar. No bootstrap is needed though, just the few lines of CSS at the top of this message.
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
yeah the sr-only thing is for when you dont want to see the span. If you do wanna see it, but you don't like how it's positioned, you can use display: flex or display: grid on the <label> and adjust the styles to your preference
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
sr-only is kinda standard amongst devs, the name can be read to mean "this class is being used to hide things visually without hiding them from the document flow that assistive technology uses"... so instead of typing all that we use sr-only and most of us have just accepted this unofficial standard name
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
for a text input it's fine to have the same label text as placeholder text, so long as you know you're allowed to have them be different. You might wanna label something "username" with the placeholder "your_name_here" or something, as long as there's a label that correctly describes the input, the placeholder is more of a UX problem than an a11y problem. Also if you're talking about a text input with placeholder="mm/dd/yyyy"... ew once for that and ew again for putting the month before the day and the year at the end
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
# **yeah** *backslash* ~~escapes~~ __any__ `discord` formatting, same as markdown
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
btw for code blocks on discord type it like this; ```html <!-- you can change that "html" to "css", "js", "ts", or any other language name for more accurate syntax highlighting --> ``` also see #👋welcome as it's got a lot more about formatting which is pretty useful
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
In that case I would do something like
<label>
<span class="sr-only">Filter by title</span>
<input type="search" placeholder="Filter by title" />
</label>
<label>
<span class="sr-only">Filter by title</span>
<input type="search" placeholder="Filter by title" />
</label>
.sr-only {
position: absolute;
left: -1000vw;
}
.sr-only {
position: absolute;
left: -1000vw;
}
Just to ensure that the input remains labelled clearly. I'm not 100% on if placeholder text is read by screenreaders or if it's a visual UI thing, but best practice says using a label makes sure you're covered
55 replies
KPCKevin Powell - Community
Created by thethingisback on 5/6/2023 in #front-end
Forms: "for" attribute when wrapping inputs in labels
In that setup you would put your label text in the span;
<label>
<span>Username</span>
<input type="text" />
</label>
<label>
<span>Username</span>
<input type="text" />
</label>
Something like that ^
55 replies