Skip to content

Instantly share code, notes, and snippets.

Avatar
🍂

Max Lynch mlynch

🍂
View GitHub Profile
@mlynch
mlynch / Heading.tsx
Last active May 11, 2020 01:10
Scroll Spy Provider
View Heading.tsx
const Heading = (props: Props) => {
const ref = useRef<HTMLHeadingElement>();
const ScrollSpy = useContext(ScrollSpyContext);
if (
ref.current &&
["H1", "H2", "H3"].indexOf(ref.current.tagName) >= 0
) {
value?.observer!.observe(ref.current);
}
View ionic-vue-inputs.vue
/**
Ionic Vue 0.0.8-next prerelease adds support for v-model to all Ionic inputs.
To try it out, run
npm install @ionic/vue@next
*/
<template>
<div class="ion-page">
<ion-header>
@mlynch
mlynch / menu.html
Last active November 2, 2017 20:32
View menu.html
<ion-split-pane>
<ion-menu [content]="nav" side="start"...>
</ion-menu>
<ion-nav [root]="rootPage" #nav main></ion-nav>
</ion-split-pane>
@mlynch
mlynch / generate.js
Last active February 7, 2019 18:11
Stencil component generator
View generate.js
/*
To setup, place in scripts/generate.js and add
"st:generate": "node scripts/generate.js"
To your npm scripts.
To generate a component in src/components/ run
npm run st:generate component my-component
@mlynch
mlynch / cordova-plugin-guide.md
Last active February 3, 2023 00:21
Cordova Plugin Developer Guide
View cordova-plugin-guide.md

Cordova Plugin Development Guide (iOS and Android)

Version: 0.0.1 updated 7/1/2016

Cordova Plugins are the magic that enable our mobile web app content to access the full power of Native SDKs underneath, but through clean JavaScript APIs that work the same across all platforms we target.

Building Cordova plugins is scary for many Cordova and Ionic developers, but it doesn't have to be. This simple guide walks through the what, when, why, and how of Cordova plugin development for iOS and Android.

Introduction

View routes.js
.get('/apple-app-site-association', function(req, res) {
res.header('Content-Type', 'application/pkcs7-mime');
res.render('apple-app-site-association.txt');
})
@mlynch
mlynch / cordova.ts
Created November 24, 2015 04:57 — forked from robwormald/cordova.ts
View cordova.ts
const promisifyCordova = (pluginName:string, methodName:string) => {
return (...args) => {
return new Promise((resolve, reject) => {
cordova.exec(resolve, reject, pluginName, methodName, args);
})
}
}
const observablifyCordova = (pluginName:string, methodName:string, cleanUpMethodName?:string) => {
return (..args) => {
@mlynch
mlynch / info.plist
Last active October 13, 2022 15:07
Disable App Transport Security in iOS 9
View info.plist
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
@mlynch
mlynch / ionRadio.js
Last active October 13, 2022 15:07
ionRadio fix for iOS 9 bugs
View ionRadio.js
/**
* ionRadioFix - fixes a bug in iOS 9 UIWebView that breaks the tilde selector in CSS. To
* use this fix, include it after your Ionic bundle JS.
*
* Note: due to Angular directive override limitations, you'll need to change any reference
* to <ion-radio> to <ion-radio-fix> to apply this patched radio button.
*
* Also, make sure to add the new CSS from the second part of this gist.
*/
angular.module('ionic').directive('ionRadioFix', function() {