Skip to content

Instantly share code, notes, and snippets.

View amygrinn's full-sized avatar

Amy Grinn amygrinn

  • 19:20 (UTC -04:00)
View GitHub Profile
@amygrinn
amygrinn / index.ts
Created December 6, 2018 06:09
Redux and Vue
import Vue from 'vue';
import * as Rx from 'rxjs/Rx';
import * as VueRx from 'vue-rx';
import Store from './store';
// Import redux modules
import * as DeviceModule from './modules/device';
@amygrinn
amygrinn / App.vue.ts
Last active December 6, 2018 06:14
Redux Module Example (device)
// Example usage of device module selectors in Vue component
import Vue from 'vue';
import { smallerOrEqTo } from './modules/device';
export default Vue.extend({
subscriptions() { return {
mobile: this.$store.select$(smallerOrEqTo('phablet'))
}; }
@amygrinn
amygrinn / index.html
Created April 2, 2019 17:01
Cordova VueJS index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
</head>
@amygrinn
amygrinn / update-version.sh
Created April 2, 2019 17:28
Update cordova version
sed -i -E 's/(<widget.+version=")[^"]*(".+)/\1'$1'\2/' config.xml
@amygrinn
amygrinn / Appfile
Last active April 2, 2019 19:59
Fastlane appfile
json_key_file "fastlane/android-service-account.json"
@amygrinn
amygrinn / .gitlab-ci.yml
Last active October 1, 2020 13:33
Gitlab CI for fastlane
stages:
- build
- package
- deploy
build:
stage: build
image: node:alpine
script:
- yarn install
@amygrinn
amygrinn / get-push-subscription.ts
Last active January 4, 2020 23:11
Get a PushSubscription or create one if it does not exist
class UnsupportedError extends Error {
constructor() {
super('Push notifications are not supported')
}
}
class NotRegisteredError extends Error {
constructor() {
super('Service worker is not registered')
}
@amygrinn
amygrinn / create-random-chalk-theme.ts
Last active September 24, 2020 15:37
Create a random theme with chalk: https://www.npmjs.com/package/chalk
import chalk, { Chalk } from 'chalk';
const modifiers: (keyof Chalk)[] = [
'bold',
'dim',
'italic',
'underline',
'inverse',
];
@amygrinn
amygrinn / webpack.config.example.js
Last active September 27, 2020 17:00
Webpack write to file
/** @type {import('webpack').Configuration} */
/**
* Write the version of the package to a file named 'latest'
* When uploaded to a server with multiple versions, you can
* get the name of the latest by running `curl https://<server>/latest`
*/
const WritePlugin = require('./build-tools/write-webpack-plugin');
const { version } = require('./package.json');
/**
* Tyler J Grinn
* tylergrinn@gmail.com
* License: MIT
*/
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { JSDOM } = require('jsdom');
/**
* Remove all tags from your html webpack template which have an attribute named `dev`