Skip to content

Instantly share code, notes, and snippets.

View cdcharlebois's full-sized avatar

Conner Charlebois cdcharlebois

View GitHub Profile
@cdcharlebois
cdcharlebois / listview-masonry.css
Created February 16, 2023 22:31
Listview Masonry (Pinterest-style layout)
.listview-masonry > ul {
column-count: 3;
column-gap: 24px;
}
/**
* @param {Nanoflow} asyncTask
* @param {Nanoflow} callback
* @returns {Promise.<void>}
*/
export async function AsyncJSAction(asyncTask, callback) {
// BEGIN USER CODE
asyncTask().then(callback)
// END USER CODE
}
@cdcharlebois
cdcharlebois / listview-horizontal.css
Created November 15, 2022 12:35
Render a listview horizontally
.listview-horizontal > ul {
display: flex;
flex-wrap: wrap;
}
.listview-horizontal > ul > li {
min-width: 200px;
flex: 1;
}
window.a = () => {console.log('hello')}
const beforeFunc = (otherFunc) => {
return () => {
console.log('me first');
otherFunc();
}
}
window.a = beforeFunc(window.a);
@cdcharlebois
cdcharlebois / theme.js
Created June 1, 2022 12:27
This limits the scaling of your fonts to 1.25x normal size. This can be adjusted as necessary, or set to 1 to disable font scaling on your app completely.
import {Text} from 'react-native';
Text.defaultProps = Text.defaultProps || {};
Text.defaultProps.maxFontSizeMultiplier = 1.25;
@cdcharlebois
cdcharlebois / waitForElement.js
Created April 15, 2022 16:22
Use this to wait for an element to be rendered before continuing
// from https://stackoverflow.com/a/61511955/1513051
function waitForElement(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
@cdcharlebois
cdcharlebois / _datagrid-checkboxes.scss
Created January 11, 2021 14:29
datagrid checkboxes
/* add the "dg-checkboxes" class to your data grid in studio pro */
.mx-datagrid.dg-checkboxes tbody tr:after{
color: red;
font-size: xx-large;
position: absolute;
left: -15px
}
.mx-datagrid.dg-checkboxes tbody tr.selected:after{
content:"☑";
}
@cdcharlebois
cdcharlebois / _form-control-append-button.scss
Last active July 23, 2020 19:31
style rule to apply to a *row* in a layout grid that will append a button to the end of the input (i.e. an inline-edit button)
.form-control-append-button {
@extend .form-group;
> div:first-child {
@extend .control-label;
@extend .d-block;
}
> div:last-child {
@extend .flexcontainer;
> div:first-child {
@extend .flexitem-main;
@cdcharlebois
cdcharlebois / _tabs-vertical.scss
Created July 22, 2020 15:45
snippet to render a tab container with vertical tabs (and panels on the right)
.tabs-vertical {
display: flex;
> ul {
// tabs
flex: 1;
border: none;
> li {
&.active {
border-left: 0.35em solid $brand-inverse;
margin-left: -0.35em;
@cdcharlebois
cdcharlebois / MendixWidgetSnippets.xml.json
Last active June 16, 2021 14:48
Add this to your `xml.json` snippets file to enable some handy snippets for Mendix widgets
////////////////////////////
// PLUGGABLE WIDGET PROPS //
////////////////////////////
"Pluggable Property Group": {
"prefix": "pprop-group",
"body": [
"<propertyGroup caption=\"${1|General,Behavior,Data Source,Appearance|}\">",
"</propertyGroup>"
]
},