Skip to content

Instantly share code, notes, and snippets.

View DavidFrahm's full-sized avatar

David Frahm DavidFrahm

  • Jefferson City, MO, USA
View GitHub Profile
@DavidFrahm
DavidFrahm / app-root.tsx
Last active January 22, 2020 00:18
FirebaseUI with Stencil ionic-pwa starter (workaround for Rollup issues)
import { Component, h } from '@stencil/core';
import { initFirebase } from '../../helpers/firebase';
@Component({
tag: 'app-root',
styleUrl: 'app-root.css'
})
export class AppRoot {
@DavidFrahm
DavidFrahm / module-spec.js
Last active December 28, 2017 10:43
Unit test for Module with $ionicPlatform.ready()
describe('Module run with $ionicPlatform.ready() as promise', function () {
'use strict';
var ionicPlatform;
var readyThenCallbackFn;
beforeEach(function () {
module('ngViews');
module('swMobileApp', function ($provide) {
$provide.value('$ionicPlatform', {
// Or like this for ready callback
//ready: jasmine.createSpy('$ionicPlatform.ready').and.callFake(function (callbackFn) {
@DavidFrahm
DavidFrahm / install
Last active December 9, 2015 21:25
Setup karma-ng-html2js-preprocessor
$ npm install --save-dev karma-ng-html2js-preprocessor
@DavidFrahm
DavidFrahm / Google Chrome Canary - Development.app
Last active October 20, 2015 19:22
AppleScript for launching Chrome Canary for local development
do shell script "/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromeCanaryTestUnsecure --new-window --window-position=0,0 --window-size=1440,900 --incognito --disable-web-security -–allow-file-access-from-files > /dev/null 2>&1 &"
delay 1
tell application "Google Chrome Canary"
activate
tell application "System Events" to keystroke "j" using {command down, option down}
end tell
@DavidFrahm
DavidFrahm / gulpfile.js
Created June 13, 2015 18:05
Gulp config with expressive path variables
var gulp = require('gulp');
var connect = require('gulp-connect');
var sass = require('gulp-sass');
var paths = {
sassEntryPointFile: './scss/main.scss',
sassInputFiles: ['./scss/**/*.scss'],
cssOutputFolder: './css/',
htmlInputFiles: ['./manage/**/*.html']
};
@DavidFrahm
DavidFrahm / bower.json
Last active August 29, 2015 14:18
Ionic unit test config
{
"name": "my-app",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-rc.2",
"angular-mocks": "~1.3.15"
},
"resolutions": {
"angular": "1.3.13"
}
@DavidFrahm
DavidFrahm / gist:4409d6b74e46377e7be7
Created January 27, 2015 22:58
Ionic build iOS app for release, open in HockeyApp for deploying to team
#!/bin/bash
echo "Building Ionic/Cordova iOS release..."
ionic build --release ios
# Save current directory and cd to other dir
pushd platforms/ios/
# Build archive
xcodebuild -scheme "MyApp" -configuration Release clean archive
# Can also specify archive path:
@DavidFrahm
DavidFrahm / release-android.sh
Last active February 22, 2017 12:15
Ionic build Android app for release, with option to open (in app such as HockeyApp for deploying to team)
#!/bin/bash
FINAL_BINARY_FILEPATH="platforms/android/build/outputs/apk/wakatime-android-release-signed.apk"
echo "*** Build Ionic release for Android ***"
rm $FINAL_BINARY_FILEPATH
ionic build --release android
echo "Signing APK..."
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/Dropbox/WakaTime/Build/Android/wakatime.keystore -storepass $WAKATIME_STOREPASS platforms/android/build/outputs/apk/android-release-unsigned.apk android
echo "Optimizing APK (zipalign)..."
~/Library/Android/sdk/build-tools/23.0.3/zipalign -v -f 4 platforms/android/build/outputs/apk/android-release-unsigned.apk $FINAL_BINARY_FILEPATH
# echo "Opening APK..."
@DavidFrahm
DavidFrahm / simulate-ios.sh
Created January 27, 2015 19:42
Ionic app build and choose iOS Simulator
#!/bin/bash
echo "Building Ionic/Cordova iOS release..."
ionic build --release ios
export DEVICES=`ios-sim showdevicetypes 2>&1`
export DEVICES=\"`echo $DEVICES | sed -e 's/ com./" "com./g' | sed -e 's/, /,~/g'`\"
PS3='Please enter your choice: '
options=($DEVICES)
app="`find ./platforms/ios/build/emulator/ -name *.app -print`"
escaped_app="\"$app\""
@DavidFrahm
DavidFrahm / 020_build_version.js
Last active December 28, 2020 00:05
Cordova build hook, to use build version from config.xml in your hybrid app
#!/usr/bin/env node
// This plugin replaces text in a file with the app version from config.xml.
var wwwFileToReplace = "js/build.js";
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];