Skip to content

Instantly share code, notes, and snippets.

🛫

Max Lynch mlynch

🛫
Block or report user

Report or block mlynch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mlynch
mlynch / Undo.md
Last active Mar 21, 2020
Undo/Redo
View Undo.md

Undo/Redo

Undo/Redo is one of those features of an application that you almost always need to have if you are building serious GUI tools for people to do work.

The best way to look at undo/redo is two stacks of operations the user has performed:

  • The Undo stack is the "history" of what they've done
  • The redo stack is the breadcrumbs back to the initial state before they started undoing
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 / cordova-plugin-guide.md
Last active Feb 4, 2020
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

@mlynch
mlynch / auth.markdown
Last active Jan 13, 2020
AngularJS Authentication and CORS
View auth.markdown

Single Page Apps are ruling the world and AngularJS is leading the charge. But many of the lessons we learned in the Web 2.0 era no longer apply, and few are as drastically different as authentication.

CORS

CORS is an oft-misunderstood feature of new browsers that is configured by a remote server. CORS stands for Cross-Origin-Resource-Sharing, and was designed to make it possible to access services outside of the current origin (or domain) of the current page.

Like many browser features, CORS works because we all agree that it works. So all major browsers like Chrome, Firefox, and IE support and enforce it. By using these browsers, you benefit from the security of CORS.

That means certain browsers do not enforce it, so it is not relevant there. One large example is a native Web View for things like Cordova and Phonegap. However, these tools often have configuration options for whitelisting domains so you can add some security that way.

@mlynch
mlynch / info.plist
Last active Sep 20, 2019
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 / autofocus.js
Last active Aug 9, 2019
AngularJS Autofocus directive
View autofocus.js
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@mlynch
mlynch / generate.js
Last active Feb 7, 2019
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
View app.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
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');
})
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>
You can’t perform that action at this time.