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 / grafana-corona-widget.html
Last active March 16, 2020 16:52
Grafana Corona widget
<!--
- 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>
@EddyVerbruggen
EddyVerbruggen / toolbar-page.xml
Created December 13, 2018 21:20
nativescript-keyboard-toolbar plugin demo for NativeScript Core
<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>
@EddyVerbruggen
EddyVerbruggen / AndroidManifest.xml
Last active January 19, 2022 02:55
App links on iOS and Android with NativeScript
/*
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"/>
@EddyVerbruggen
EddyVerbruggen / Code.gs
Last active October 3, 2018 19:32
Google Apps Script that adds GitHub repo and PR labels to your Gmail inbox
function processInbox() {
var threads = GmailApp.search("is:unread in:inbox has:nouserlabels from:notifications@github.com newer_than:1h");
for (var i = 0; i < threads.length; i++) {
var messages = threads[i].getMessages();
for (var j = 0; j < messages.length; j++) {
processMessage(messages[j]);
}
}
@EddyVerbruggen
EddyVerbruggen / nativescript-radlistview-activityindicators-appearance.ts
Last active October 21, 2018 17:04
Change appearance of Activity Indicators in NativeScript RadListView
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;
@EddyVerbruggen
EddyVerbruggen / base64.ts
Created January 18, 2018 15:51
base64 encoder (btoa) / decoder (aotb) shim for NativeScript
// 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);
@EddyVerbruggen
EddyVerbruggen / nativescript-is24HourFormat.ts
Last active September 12, 2017 06:36
Determine whether or not an iOS or Android device is running in 24 hour format
import { ad } from "tns-core-modules/utils/utils";
import { isIOS } from "tns-core-modules/platform";
let is24HourFormat: boolean;
if (isIOS) {
// solution from https://stackoverflow.com/a/12236693/2596974
const dateFormat: string = NSDateFormatter.dateFormatFromTemplateOptionsLocale("j", 0, NSLocale.currentLocale);
is24HourFormat = dateFormat.indexOf("a") === -1;
} else {
// https://developer.android.com/reference/android/text/format/DateFormat.html#is24HourFormat(android.content.Context)
@EddyVerbruggen
EddyVerbruggen / nativescript-apply-cssfile-at-runtime.ts
Last active June 14, 2017 09:50
App component specific tablet CSS file in NativeScript
import { Component, OnInit } from "@angular/core";
import { DeviceType } from "ui/enums";
import { device } from "platform";
import { Page } from "ui/page";
@Component({
moduleId: module.id,
selector: "my-component",
templateUrl: "my-component.html",
styleUrls: ["my-component.css"]
@EddyVerbruggen
EddyVerbruggen / nativescript-global-tablet-specific-styles.ts
Created June 14, 2017 09:07
Global tablet CSS for NativeScript apps
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({
// ..
})
@EddyVerbruggen
EddyVerbruggen / nativescript-tablet-specific-styles.css
Created June 14, 2017 08:58
Tablet CSS for NativeScript apps
/* my-component.css */
Label.text {
font-size: 15;
}
/* my-component.tablet.css */
.tablet Label.text {
font-size: 19;
}