Skip to content

Instantly share code, notes, and snippets.

View kerren's full-sized avatar

Kerren Ortlepp kerren

View GitHub Profile
@kerren
kerren / download_zen_browser.sh
Created December 16, 2024 18:01
A script that downloads Zen browser and installs it to /usr/local/src/zen
#!/bin/bash
VERSION=${1:-1.0.2-b.2}
echo "Downloading version ${VERSION}..."
wget "https://github.com/zen-browser/desktop/releases/download/${VERSION}/zen.linux-specific.tar.bz2" -O /tmp/zen.linux-specific.tar.bz2
echo "Removing old build (if it exists)..."
@kerren
kerren / zen-browser.desktop
Created December 16, 2024 17:57
zen browser linux desktop icon (shoutout to flatpak maintainers for this, I modified theirs)
[Desktop Entry]
Name=Zen Browser
Exec=/usr/local/src/zen/zen-bin
Icon=/usr/local/src/zen/browser/chrome/icons/default/default128.png
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=zen-alpha
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
@kerren
kerren / track-focus.directive.ts
Last active March 23, 2024 09:12
A directive that allows you to see if an input is in focus or not. See my blog article here https://blog.entrostat.com/angular-inputs-improved-error-ux/ and see StackOverflow article that inspired this here https://stackoverflow.com/questions/57536298/how-to-check-if-an-input-field-is-in-focus-in-angular-7/57536348#57536348
import { Directive, HostListener, signal } from '@angular/core';
@Directive({
selector: '[appTrackFocus]',
standalone: true,
exportAs: 'isFocused',
})
export class TrackFocusDirective {
isFocused = signal(false);
@kerren
kerren / install_byobu.sh
Last active February 11, 2025 09:57
Install byobu from source
# Full instructions
# https://blog.entrostat.com/install-byobu-on-any-linux-distro/
BYOBU_VERSION=5.133
set -e
echo "Please make sure you have the following dependencies installed:"
echo " [+] tar"
echo " [+] screen"
@kerren
kerren / partial-type.ts
Created March 25, 2021 10:14
[Partial types] An example where we don't need the whole item #types #partial #typescript
class Person {
name: string;
surname: string;
email: string;
age: number;
uuid: string;
};
async function confirmSurname(person: Partial<Person>) {
if (!person.email) {
@kerren
kerren / object-key-names.ts
Created March 22, 2021 19:26
[Object key names] Name your variables right! #object #names #typescript
const name = 'John';
const surname = 'Doe';
const someOtherVariableThatIsNotNamedCorrectly = 22;
const person = { name, surname };
const personWithAge = {
name,
surname,
age: someOtherVariableThatIsNotNamedCorrectly
@kerren
kerren / cool-maps.ts
Created March 22, 2021 19:18
[A map key] A map can take any type of key! #map #typescript
const map = new Map();
map.set(1, 'simple');
console.log(map.get(1));
// 'simple'
const person = {
name: 'John',
surname: 'Doe'
};
@kerren
kerren / spread-operator.ts
Last active March 22, 2021 19:21
[The spread operator] A simple example to show how it works #spread #operator #typescript
const a = {
character: 'a',
description: 'This is a',
level: 1,
aUnique: 123
};
const b = {
description: 'This is b',
bbb: 'b'
@kerren
kerren / main.ts
Created March 22, 2021 18:52
[TSConfig Paths Import Example] How to use these paths in code #tsconfig #paths #typescript
// Before the "@config" path
import * as config from '../../config';
import { Config } from '../../config';
// After the "@config" path
import * as config from '@config';
import { Config } from '@config';
@kerren
kerren / tsconfig.json
Last active March 22, 2021 18:45
[TSconfig paths example] A sample config #tsconfig #typescript
{
"compiler": {
"paths": {
"@config": ["src/config"],
"@logger": ["src/modules/shared/logger/logger.service"],
"@modules/*": ["src/modules/*"]
}
}
}