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 / 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 / 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-segmentedbar-selected-text-color.ts
Last active December 19, 2017 11:38
Change the text color of the selected item in a NativeScript SegmentedBar
import { Color } from "tns-core-modules/color";
declare const UIControlStateSelected: any;
export class CheckoutComponent implements OnInit {
// this assumes you have this in your html: <SegmentedBar #paymentOptionsBar ..>
@ViewChild("paymentOptionsBar") paymentOptionsBar: ElementRef;
ngOnInit(): void {
@EddyVerbruggen
EddyVerbruggen / radsidedrawer-component.ts
Last active September 11, 2018 10:23
Adding depth / shadow to your NativeScript RadSideDrawer (iOS)
// In case of Angular, this is the component that contains a view with a <RadSideDrawer>
export class MenuComponent implements AfterViewInit {
@ViewChild(RadSideDrawerComponent) public drawerComponent: RadSideDrawerComponent;
private _drawer: SideDrawerType;
ngAfterViewInit(): void {
this._drawer = this.drawerComponent.sideDrawer;
this._changeDetectionRef.detectChanges();
@EddyVerbruggen
EddyVerbruggen / label-max-lines.directive.ts
Last active November 22, 2023 06:13 — forked from m-abs/label-max-lines.directive.ts
Directive for NativeScript-angular, adding the property maxLines to Label
// 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]',
})
@m-abs
m-abs / label-max-lines.directive.ts
Created March 10, 2017 14:38
Directive for NativeScript-angular, adding the property maxLines to Label
import { Directive, ElementRef, Input, OnInit, OnChanges } from '@angular/core';
import { Label } from 'ui/label';
@Directive({
selector: '[maxLines]',
})
export class LabelMaxLinesDirective implements OnInit, OnChanges {
@Input('maxLines') public maxLines: number = 1;
public get nativeView(): Label {
@NathanWalker
NathanWalker / app.component.ts
Last active December 13, 2017 15:54
NativeScript: Wire up RadSideDrawer from 'nativescript-telerik-ui' with Angular2 taking full advantage of Router
// angular
import {Component} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app',
template: `
<StackLayout>
<page-router-outlet></page-router-outlet>
</StackLayout>
// 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();