Skip to content

Instantly share code, notes, and snippets.

View yccheok's full-sized avatar

Yan Cheng Cheok yccheok

View GitHub Profile
func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
var entries: [SimpleEntry] = []
let currentDate = Date()
let stickyNote = NSPlainNoteRepository.getStickyNote(configuration)
let entry = SimpleEntry(date: currentDate, stickyNote: stickyNote)
entries.append(entry)
let timeline = Timeline(entries: entries, policy: .never)
completion(timeline)
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.gms.ads.nativead.NativeAdView
android:background="#ffffff"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_centerInParent="true"
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.gms.ads.nativead.NativeAdView
android:background="#ffffff"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_centerInParent="true"
struct widgetEntryView : View {
var entry: Provider.Entry
// https://stackoverflow.com/questions/56487323/make-a-vstack-fill-the-width-of-the-screen-in-swiftui
var body: some View {
HStack {
VStack(alignment: .leading) {
Text("H H")
Text("Good bye world Good bye world Good byfd 3 4 5 6")
Spacer()
class Fragment {
private void displayAdMob() {
initializeMobileAdsAsyncIfPossible(() -> {
...
adView.loadAd(adRequest);
});
}
}
//
// ShareViewController.swift
// share
//
// Created by Yan Cheng Cheok on 03/11/2022.
//
import UIKit
import lib
import CoreServices
@yccheok
yccheok / gist:437fad5e31504e52365d5ab5c4507bc3
Created October 21, 2022 10:09
Demo for real-time time series graph
package com.demo.demo;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
FirebaseApp.configure()
// Not sure why. We need to call this function for first_open to be sent automatically.
// https://stackoverflow.com/questions/73600417/why-firebase-analytics-first-open-event-is-not-sent-automatically-unless-i-first
This file has been truncated, but you can view the full file.
[{"symbol":"-S","exchange":"XNYS","exchangeSuffix":"","exchangeName":"New York Stock Exchange Inc","exchangeSegment":"XNYS","exchangeSegmentName":"New York Stock Exchange Inc","name":"Prudential Financial Inc. - 5.625% NT REDEEM 15/08/2058 USD 25","date":"2022-07-15","type":"ps","iexId":null,"region":"US","currency":"USD","isEnabled":true,"figi":"BBG00LNCR467","cik":"0001137774","lei":"5PRBRS5FEH7NREC8OR45"},{"symbol":"A","exchange":"XNYS","exchangeSuffix":"","exchangeName":"New York Stock Exchange Inc","exchangeSegment":"XNYS","exchangeSegmentName":"New York Stock Exchange Inc","name":"Agilent Technologies Inc.","date":"2022-07-15","type":"cs","iexId":"IEX_46574843354B2D52","region":"US","currency":"USD","isEnabled":true,"figi":"BBG000C2V3D6","cik":"0001090872","lei":"QUIX8Y7A2WP0XRMW7G29"},{"symbol":"AA","exchange":"XNYS","exchangeSuffix":"","exchangeName":"New York Stock Exchange Inc","exchangeSegment":"XNYS","exchangeSegmentName":"New York Stock Exchange Inc","name":"Alcoa Corp","date":"2022-07-15","type"
/*
See LICENSE folder for this sample’s licensing information.
Abstract:
A class to set up the Core Data stack, observe Core Data notifications, process persistent history, and deduplicate tags.
*/
import Foundation
import CloudKit
import CoreData