Skip to content

Instantly share code, notes, and snippets.

View dossy's full-sized avatar
🍪
derping around

Dossy Shiobara dossy

🍪
derping around
View GitHub Profile
@dossy
dossy / unnest_error_demo.md
Last active August 20, 2024 15:30
Unsupported PartiQL correlated subquery, `nested_decorrelate_validate`

Trying to unnest SUPER data in Amazon Redshift

Working in Amazon Redshift, I got the following error:

ERROR:  Query unsupported due to an internal error.
DETAIL:  Unsupported PartiQL correlated subquery
CONTEXT:  nested_decorrelate_validate|
@dossy
dossy / How_to_install_jdbc_fdw_with_PostgreSQL_15_on_Amazon_Linux_2023.md
Last active February 18, 2024 00:33
How to install `jdbc_fdw` with PostgreSQL 15 on Amazon Linux 2023

How to install jdbc_fdw into PostgreSQL 15 on Amazon Linux 2023

These instructions were written and tested on 2024-02-17, using Amazon Linux 2023 AMI 2023.3.20240205.2 arm64 HVM kernel-6.1 (ami-0bbebc09f0a12d4d9) on a t4g.medium (2 vCPU, 4 GiB RAM) instance.

Instructions

Step 1. Install prerequisite packages

@dossy
dossy / README.md
Last active February 4, 2024 00:53
Using GNU enscript and Ghostscript to simulate 132x66 output to PDF

Using GNU enscript to simulate 132x66 output to PDF

Prerequisites

Command

This command will produce an out.pdf file containing two full pages of X characters, with each page fitting 132x66 characters on Legal (8.5"x14") paper in landscape orientation using fixed-width Courier font.

@dossy
dossy / utils.js
Last active January 5, 2024 18:29
Helpful JS utilities
/**
* Sleeps for `ms` milliseconds.
*
* @param {number} ms - Sleep duration in milliseconds.
* @returns {Promise<void>}
*
* @example
* // Sleep for 250ms.
* await sleep(250);
*/
@dossy
dossy / dispatchEvent-on-input-textarea-ignored-solution.js
Last active November 27, 2023 23:32
dispatchEvent on input/textarea ignored
// from: https://github.com/facebook/react/issues/10135#issuecomment-314441175
// fatfisz <https://github.com/fatfisz> commented on Jul 11, 2017
// Just leaving a solution for future reference (checked in Edge 15, IE 11, FF 53, Chrome 59):
function setNativeValue(element, value) {
const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;
const prototype = Object.getPrototypeOf(element);
const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;
@dossy
dossy / dom-to-json.js
Created November 8, 2021 20:08 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
function toJSON(node) {
let propFix = { for: 'htmlFor', class: 'className' };
let specialGetters = {
style: (node) => node.style.cssText,
};
let attrDefaultValues = { style: '' };
let obj = {
nodeType: node.nodeType,
};
if (node.tagName) {
@dossy
dossy / renpy_screen_choice.md
Last active April 10, 2024 23:51
Ren'Py: Blur scene behind choice menu, fade choices in and out.

How to apply transitions to the current scene behind a Ren'Py choice menu

Here is example code to apply the blur transform to the master layer when a choice menu is displayed, along with applying a fade-in and fade-out effect of the choice items.

This was tested on Ren'Py 7.4.0.1167.

@dossy
dossy / main.dart
Created December 18, 2020 17:17
Dart List<NetworkImage> example
// for: https://stackoverflow.com/questions/65272176/how-to-solve-type-listdynamic-is-not-a-subtype-of-type-string
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
@dossy
dossy / keybase.md
Created December 14, 2019 16:26
Keybase proof

Keybase proof

I hereby claim:

  • I am dossy on github.
  • I am dossy (https://keybase.io/dossy) on keybase.
  • I have a public key whose fingerprint is C535 6302 1171 987D 738E BFD8 2B1A B2E1 8D97 40AA

To claim this, I am signing this object:

@dossy
dossy / snippet.html
Last active October 29, 2022 14:01
Disable submit buttons on Gravity Forms when required fields are empty
<script type="text/javascript">
// don't forget to add a style for:
// `input[type="submit"].disabled, input[type="submit"].button-disabled, input[type="submit"]:disabled`
jQuery(function ($) {
$('form[id^="gform_"]').on('change', function (e) {
var $reqd = $(this).find('.gfield_contains_required.gfield_visibility_visible').filter(function (i, c) {
return []
.concat($(c).find('input[type="text"], textarea').filter(function (i, fl) { return $(fl).val().length == 0; }).get())
.concat($(c).find('input[type="checkbox"]').not(':checked').get())
.length;