Skip to content

Instantly share code, notes, and snippets.

View xpaulnim's full-sized avatar
🌼

Paul Nimusiima xpaulnim

🌼
  • United Kingdom
View GitHub Profile
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<opml version="1.0">
<head>
<title>Pocket Casts Feeds</title>
</head>
<body>
<outline text="feeds">
<outline type="rss" text="Yada Yada Cast" xmlUrl="http://feeds.soundcloud.com/users/soundcloud:users:279952541/sounds.rss" />
<outline type="rss" text="Gugacast" xmlUrl="http://gugacast.libsyn.com/rss" />
<outline type="rss" text="Revolushow" xmlUrl="http://feeds.feedburner.com/Revolushow" />
@xpaulnim
xpaulnim / MergeStrings.java
Created May 1, 2018 00:32
MergeStrings java
static String MergeStrings(String[] strings) {
Map<Character, Integer> charCount = new HashMap<>();
for (String str : strings) {
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (Character.isAlphabetic(c)) {
charCount.merge(c, 1, (a, b) -> a + b);
}
@xpaulnim
xpaulnim / Application.vala
Created June 5, 2018 18:19
Load Images Asynchronously Gtk Vala
// Compile with valac --pkg gtk+-3.0 --pkg=gio-2.0 Application.vala
public class Application : Gtk.Application {
private const int COVER_SIZE = 170;
public Application () {
Object(application_id: "testing.my.application",
flags: ApplicationFlags.FLAGS_NONE);
}
@xpaulnim
xpaulnim / Application.vala
Created August 4, 2018 19:02
Load remote images asyncronously using a cache.
// Compile with valac --pkg gtk+-3.0 --pkg=gio-2.0 Application.vala
public class Application : Gtk.Application {
private const int COVER_SIZE = 170;
private const int NAP_TIME = 500; // 0.1 Seconds
private const int MAX_TIMEOUT = 30000; // 30 Seconds
public Application () {
Object(application_id: "testing.my.application",
@xpaulnim
xpaulnim / pulseaudio_devices.vala
Last active November 21, 2020 16:52
Using the Introspection Event API for PulseAudio asyncronus API in vala.
// sudo apt install libpulse-dev
// valac -X -lm --pkg libpulse --pkg posix --pkg gtk+-3.0 --pkg libpulse-mainloop-glib pulseaudio_devices.vala
public class AudioDevice : GLib.Object {
private PulseAudio.GLibMainLoop loop;
private PulseAudio.Context context;
private PulseAudio.Context.Flags cflags;
public AudioDevice () {
@xpaulnim
xpaulnim / MouseScrollEventSwiftUI.swift
Last active January 5, 2024 20:55
Capture mouse scroll events - SwiftUI
// Built this simple example by reading these two files
// - https://github.com/iina/iina/blob/dcb8bbda72a5a725bb68d9eae53f806dc6c72273/iina/PlayerWindowController.swift
// - https://github.com/insidegui/VirtualBuddy/blob/main/VirtualUI/Source/Session/Components/SwiftUIVMView.swift
// - https://stackoverflow.com/questions/64530822
import SwiftUI
struct MouseWheelScrollEventView: NSViewRepresentable {
typealias NSViewType = MouseView