This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: <Label maxLines="3" .. /> | |
import { Directive, ElementRef, Input, OnInit, OnChanges } from '@angular/core'; | |
import { Label } from 'tns-core-modules/ui/label'; | |
declare const android, NSLineBreakMode: any; | |
@Directive({ | |
selector: 'Label[maxLines]', | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Add this to your <activity>, so any link (clicked in fi. an e-mail) | |
will open your app instead of the website, but only if it matches these whitelisted path patterns | |
*/ | |
<activity android:launchMode="singleInstance"><!-- set the launchMode property to this value! --> | |
<intent-filter> | |
<action android:name="android.intent.action.VIEW"/> | |
<category android:name="android.intent.category.DEFAULT"/> | |
<category android:name="android.intent.category.BROWSABLE"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base64 encoder (btoa) / decoder (atob) which you can use in your NativeScript app. | |
// | |
// Usage (assuming you're in some component and this file is in the same folder: | |
// | |
// require('./base64'); | |
// | |
// const username = "My Usernamé"; | |
// usernameBase64Encoded = btoa(username); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In case you embed a webview in a native app and the native app has a navigation bar you may find | |
// swiping up from the webview to the header (and releasing your finger on the header) will not fire | |
// a 'touchend' event on the webview. | |
// | |
// This code fixes it in a way where we listen for 'touchmove' events and fire a 'touchend' event | |
// programmatically in case the user leaves the webview at the top (negative Y coordinate): | |
document.addEventListener("touchmove", function(e) { | |
if (e.changedTouches[0].pageY < 0) { | |
e.preventDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MyComponent implements AfterViewInit { | |
// assuming your view has this: <TextField #myTextField text="I have a red caret"></TextField> | |
@ViewChild("myTextField") myTextField: ElementRef; | |
ngAfterViewInit(): void { | |
// note that if you don't have iOS typings you can change 'UITextField' to 'any' | |
let textField: UITextField = (<TextField>this.myTextField.nativeElement).ios; | |
textField.tintColor = new Color("red").ios; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
- Add a 'Text' widget with the content below (set 'mode' to 'html'). | |
- Make sure to enable JS parsing for this widget by setting the 'disable_sanitize_html' property to 'true' in your grafana.ini. | |
- For more detailed info, check out fi. https://www.worldometers.info/coronavirus/ | |
- STAY SAFE FOLKS! | |
--> | |
<center> | |
<div style="font-size: 20px">🦠<span id="confirmed"/></div> | |
<div style="font-size: 16px">💀<span id="deaths" /><span id="deathrate" style="color: #555; padding-left: 8px"/></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from "@angular/core"; | |
import { DeviceType } from "ui/enums"; | |
import { device } from "platform"; | |
import * as application from "application"; | |
const fs = require("file-system"); | |
@NgModule({ | |
// .. | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:kt="nativescript-keyboard-toolbar"> | |
<!-- This GridLayout wrapper is required; it wraps the visible layout and the Toolbar layout(s) --> | |
<GridLayout> | |
<StackLayout> | |
<Label text="Some text"/> | |
<!-- Add an 'id' property that we can reference below --> | |
<TextField id="priceTextField" hint="Enter the price" keyboardType="number"/> | |
</StackLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ComponentWithRadListView { | |
// assuming you have something like this in your view: | |
// <RadListView (loaded)="onOrderListLoaded($event)"> | |
onOrderListLoaded(args): void { | |
const listViewElement = <RadListView>args.object; | |
const tk: any = listViewElement.ios; | |
if (tk && tk.pullToRefreshView) { | |
tk.pullToRefreshView.activityIndicator.color = new Color("#4CC55B").ios; |
NewerOlder