Skip to content

Instantly share code, notes, and snippets.

Avatar
🔌
plugged in

Eddy Verbruggen EddyVerbruggen

🔌
plugged in
View GitHub Profile
View grafana-corona-widget.html
<!--
- 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 Dec 13, 2018
nativescript-keyboard-toolbar plugin demo for NativeScript Core
View toolbar-page.xml
<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 Mar 9, 2020
App links on iOS and Android with NativeScript
View AndroidManifest.xml
/*
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 Oct 3, 2018
Google Apps Script that adds GitHub repo and PR labels to your Gmail inbox
View Code.gs
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 Oct 21, 2018
Change appearance of Activity Indicators in NativeScript RadListView
View nativescript-radlistview-activityindicators-appearance.ts
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 Jan 18, 2018
base64 encoder (btoa) / decoder (aotb) shim for NativeScript
View base64.ts
// 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 Sep 12, 2017
Determine whether or not an iOS or Android device is running in 24 hour format
View nativescript-is24HourFormat.ts
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 Jun 14, 2017
App component specific tablet CSS file in NativeScript
View nativescript-apply-cssfile-at-runtime.ts
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"]
View nativescript-global-tablet-specific-styles.ts
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({
// ..
})
View nativescript-tablet-specific-styles.css
/* my-component.css */
Label.text {
font-size: 15;
}
/* my-component.tablet.css */
.tablet Label.text {
font-size: 19;
}
You can’t perform that action at this time.