Skip to content

Instantly share code, notes, and snippets.

View edvinassabaliauskas's full-sized avatar

Edvinas Sabaliauskas edvinassabaliauskas

View GitHub Profile
import Dispatch
private var throttleItems = Atomic([AnyHashable: ThrottleItem]())
private var debounceItems = Atomic([AnyHashable: DebounceItem]())
extension DispatchQueue {
/// First action is executed, then other actions will be performed at most once per specified interval.
/// - Note:
/// Only the first call's `interval` is taken into account and updated every interval.
@edvinassabaliauskas
edvinassabaliauskas / SwipeableViewController.swift
Last active August 16, 2021 07:06
Implements 2 finger swipe using scroll event tracking
class SwipeableViewController: NSViewController {
private var isHandlingScrollEvent = false
private var swipeLeftExecuted = false
private var swipeRightExecuted = false
private var scrollDeltaX: CGFloat = 0
override func wantsScrollEventsForSwipeTracking(on axis: NSEvent.GestureAxis) -> Bool {
return axis == .horizontal
}
@edvinassabaliauskas
edvinassabaliauskas / rocket_theme_dark.js
Last active January 7, 2024 13:22
Dark theme enabler for Rocket.Chat. Theme taken from https://github.com/0x0049/Rocket.Chat.Dark
var ThemeEnabler = {
isThemeOn: false,
controls: null,
onAppLoaded: async function() {
this.checkCookie()
do {