Skip to content

Instantly share code, notes, and snippets.

simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using (iTerm has mouse support)
Then install
# More on mouse support
simme / UITabBarController+ToggleTabBar.swift
Created January 25, 2018 15:36
Extension on UITabBarController for hiding/showing the tab bar.
extension UITabBarController {
Show or hide the tab bar.
- Parameter hidden: `true` if the bar should be hidden.
- Parameter animated: `true` if the action should be animated.
- Parameter transitionCoordinator: An optional `UIViewControllerTransitionCoordinator` to perform the animation
along side with. For example during a push on a `UINavigationController`.
initialState: .init(),
reducer: UserRecipesListReducer().relay { [unowned self] featureAction in
// Handle action here
simme / StoreControllerDialogs.swift
Created April 4, 2023 08:44
UIKit helpers for presenting alerts and confirmation dialogs
Example usage:
store: store.scope(state: \.destination, action: UserRecipesListReducer.Action.destination),
state: /UserRecipesListReducer.Destination.State.confirmation,
action: UserRecipesListReducer.Destination.Action.confirmation
).store(in: &subscriptions)
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
// debounce-throttle.swift
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
import Foundation
extension TimeInterval {
import CloudKit
import Combine
/// A publisher that wraps a `CKFetchRecordZoneChangesOperation` and emits events as the operation completes.
/// The `FetchRecordZoneChangesPublisher` fetches changes from the given record zones. New and deleted records are
/// posted individually via the `.recordChanged` and `.recordDeleted` actions.
/// Errors are automatically retried if possible. Resetting the change token in case it expired is also automatically
/// handled. Because emitting errors fails a publisher all errors are posted as actions. There may still be running
simme / UNNotification+Reschdule.swift
Created November 17, 2016 09:43
Exntension to `UNNotification` for "snoozing" a notification.
// UNNotification+Reschedule.swift
// Meal Plan
// Created by Simon Ljungberg on 17/11/16.
// License: MIT
import UIKit
import UserNotifications
simme / Label.swift
Created May 16, 2018 09:09
A `UILabel` subclass that allows content padding.
// MIT License applies.
import UIKit
A `UILabel` subclass that provides a way of adding padding to the label.
open class Label: UILabel {
/// The amount of padding for each side in the label.

Given these two tables


id name weight
1 Groceries 0
2 Pharmacy 1
3 Misc 2
simme / Base64Image.php
Created December 30, 2010 09:57
Returns the Base64 encoded version of an image. Has basic support for Drupal module ImageCache. Does not depend on Drupal.
* @file
* Helper class for encoding images as Base64.
* Has support for the Drupal module ImageCache, just provide it with your
* preset name if you'd like the class to use that version of an image instead.
* Is by no means dependent on Drupal though. Just a nice feature.
* Feel free to use it as you like.
* @author Simon Ljungberg <>