Skip to content

Instantly share code, notes, and snippets.

View EddyVerbruggen's full-sized avatar
🔌
plugged in

Eddy Verbruggen EddyVerbruggen

🔌
plugged in
View GitHub Profile
@EddyVerbruggen
EddyVerbruggen / app.js
Last active June 20, 2016 06:20
NativeScript 3D Touch shortcut icons
// Open your app's main js file and add this handler (delimited by 'START 3DTouch wiring' and 'END 3DTouch wiring').
// Then tweak the handling of 'shortcutItem.type' to your liking (here I'm deeplinking 'compose' to the 'compose' page and ignore other shortcut types).
var application = require("application");
application.cssFile = "./app.css";
application.mainModule = "main-page";
// START 3DTouch wiring
var MyDelegate = (function (_super) {
@ivanbuhov
ivanbuhov / app.css
Last active January 4, 2017 15:05
Proof of concept NativeScript app whcih is using HomeKit API
.title {
font-size: 30;
horizontal-align: center;
margin:20;
}
button {
font-size: 42;
horizontal-align: center;
}

A Very Rough Guide to Firebase and NativeScript

Create Plugin

  • mkdir nativescript-firebase
  • cd nativescript-firebase
  • npm init
  • tns init
  • mkdir -p platforms/ios
  • touch platforms/ios/Podfile
angular.module('sfViewCtrlDirective', [])
.directive('open', OpenDirective);
function OpenDirective() {
return {
restrict: 'A',
link: function($scope, $element, $attr) {
console.log('device is ready');
$element.on('click', function() {
@EddyVerbruggen
EddyVerbruggen / yourapp.plist
Last active September 11, 2015 19:03
Whitelist your server for iOS9 non-HTTPS communication
<!--
When building with XCode 7 (iOS9 SDK), Apple restricts communication to SSL servers only.
See https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
You can override this if you need to.
If you know which servers your app talks to, look for 'NSExceptionDomains' on the page above.
But if you need to whitelist everything (not recommended) add this to your app's .plist:
-->
@EddyVerbruggen
EddyVerbruggen / Tweet-a-selfie
Created April 13, 2015 06:01
Tweet a selfie with the Cordova SocialSharing plugin
navigator.camera.getPicture(
function(base64EncodedImg) {
// wrap in a timeout so the native view of SocialSharing doesn't collide with the one from the camera plugin
setTimeout(function() {
window.plugins.socialsharing.shareViaTwitter('Check my latest selfie. I\'m awesome!', 'data:image/jpg;base64,'+base64EncodedImg, null, null, null);
}, 500);
},
function(msg) {
alert("Error: " + msg);
},
Run this in your Mac Terminal (assuming you have the Ionic CLI):
----------------------------------------------------------------
ionic start wkwebviewpolyfilltest
cd wkwebviewpolyfilltest
ionic setup sass
ionic platform add ios
ionic plugin add https://github.com/EddyVerbruggen/cordova-plugin-wkwebview
ionic build
----------------------------------------------------------------
@EddyVerbruggen
EddyVerbruggen / iOS8 Beta Phonegap fix
Last active December 8, 2018 05:28
iOS8 Beta Phonegap fix: manually set the navigator.userAgent
// temp fix for iOS8 beta 1 (fixed in beta 2), add it after the reference to cordova.js
if (navigator.userAgent === undefined) {
navigator.__defineGetter__('userAgent', function() {
return("Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit");
});
}