Skip to content

Instantly share code, notes, and snippets.

@sketchbuch
sketchbuch / change_version.sh
Last active April 28, 2024 11:23
Update version in package.json and someother file via bash
# =========================================================
# Increase version in both package.json and some other file
# =========================================================
# I needed to update the version in package.json and in a typescript class.
# Version in class is used to check if caches need dropping
# Didn't want to include package.json in the typescript class as this would have added the whole package.json to the dist bundle
# So I created this script to update both.
# Will exit if no version provided, but no check is made if the format of the version is correct.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE gamebook SYSTEM "gamebook.dtd" [
<!ENTITY % general.links SYSTEM "genlink.mod">
%general.links;
<!ENTITY % xhtml.links SYSTEM "htmllink.mod">
%xhtml.links;
<!ENTITY % general.inclusions SYSTEM "geninc.mod">
%general.inclusions;
@sketchbuch
sketchbuch / ts-overwrite-inherited-prop.ts
Last active July 31, 2020 15:00
TS - Inherit from interface and overwrite inherited prop
export interface InterfaceA {
value: string
}
export interface InterfaceB extends Omit<InterfaceA, 'value'> {
value: boolean
}
@sketchbuch
sketchbuch / git-delete-commit.txt
Last active July 27, 2020 05:17
GIT - Delete last commit
Delete Last Commit
==================
# Remove last commit locally
git reset HEAD^
# Push changes to remote which will remove the commit
git push origin +HEAD
@sketchbuch
sketchbuch / flutter-how-to-debug.dart
Last active April 25, 2020 11:53
FLUTTER - How to Debug
import 'dart:developer';
// ...
log(stringData);
// ...
@sketchbuch
sketchbuch / jest-mock-usehistory-hook.ts
Last active March 29, 2023 13:12
TESTING - Jest mock useHistory hook for a test
// Imports go here... no need to import react-router-dom
jest.mock('react-router-dom', () => ({
useHistory: () => ({ push: jest.fn() }),
}))
// describe(), test() etc go here...
@sketchbuch
sketchbuch / ubuntu-terminal-padding.txt
Last active October 25, 2023 11:18
UBUNTU - Terminal Padding
Add Padding To Terminal
=======================
> gedit .config/gtk-3.0/gtk.css
Add the following to gtk.css and restart Terminal:
VteTerminal,
TerminalScreen,
vte-terminal {
@sketchbuch
sketchbuch / linux-commands-fonts.txt
Last active April 4, 2020 06:59
UBUNTU - Commands
Rebuild Font Cache
==================
> sudo fc-cache -f -v