Skip to content

Instantly share code, notes, and snippets.

View cdcharlebois's full-sized avatar

Conner Charlebois cdcharlebois

View GitHub Profile
@cdcharlebois
cdcharlebois / smartMobileInit.js
Created June 27, 2017 20:53
replace the standard 'deviceready' event listener with this one, in bundle.js
document.addEventListener("deviceready",function(){i.loadJSON("settings.json",function(e){var i=JSON.parse(e),l=localStorage.getItem("mx-prior-url");if(l)if(confirm("Do you want to initialize "+l+" ?"))r.initialize(l,i.hybridTabletProfile,i.hybridPhoneProfile,i.enableOffline,i.requirePin);else if(o=confirm("Do you want to use the default url: "+i.url+" ?"))localStorage.setItem("mx-prior-url",i.url),r.initialize(i.url,i.hybridTabletProfile,i.hybridPhoneProfile,i.enableOffline,i.requirePin);else{t=prompt("Enter a new URL to initialize:");localStorage.setItem("mx-prior-url",t),r.initialize(t,i.hybridTabletProfile,i.hybridPhoneProfile,i.enableOffline,i.requirePin)}else{var o=confirm("Do you want to use the default url: "+i.url+" ?");if(o)localStorage.setItem("mx-prior-url",i.url),r.initialize(i.url,i.hybridTabletProfile,i.hybridPhoneProfile,i.enableOffline,i.requirePin);else{var t=prompt("Enter a new URL to initialize:");localStorage.setItem("mx-prior-url",t),r.initialize(t,i.hybridTabletProfile,i.hybridPhoneProf

Keybase proof

I hereby claim:

  • I am cdcharlebois on github.
  • I am mxconner (https://keybase.io/mxconner) on keybase.
  • I have a public key ASAYScDfGZyay7rPlcwpERMfVKr7MOMhDFpnI7sT3cMROwo

To claim this, I am signing this object:

@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>"
]
},
@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 / _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 / _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 / 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 / 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;
window.a = () => {console.log('hello')}
const beforeFunc = (otherFunc) => {
return () => {
console.log('me first');
otherFunc();
}
}
window.a = beforeFunc(window.a);
@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;
}