Skip to content

Instantly share code, notes, and snippets.

View vlondon's full-sized avatar
😉
Night worker

Vladimirs Matusevics vlondon

😉
Night worker
View GitHub Profile
@alongotv
alongotv / OnDidAppearSwiftUI
Last active February 10, 2023 17:21
Adds viewDidAppear callback to SwiftUI
struct ViewControllerLifecycleHandler: UIViewControllerRepresentable {
func makeCoordinator() -> ViewControllerLifecycleHandler.Coordinator {
Coordinator(onDidAppear: onDidAppear)
}
let onDidAppear: () -> Void
func makeUIViewController(context: UIViewControllerRepresentableContext<ViewControllerLifecycleHandler>) -> UIViewController {
context.coordinator
}
@groue
groue / CancelBag.swift
Last active April 5, 2024 19:12
CancelBag
import Combine
import Foundation
/// A thread-safe store for cancellables which addresses usability pain points
/// with stock Combine apis.
///
/// ## Thread-safe storage of cancellables
///
/// let cancelBag = CancelBag()
/// cancellable.store(in: cancelBag)
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@magnetikonline
magnetikonline / README.md
Last active March 14, 2024 22:48
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@greenido
greenido / exportjson.js
Created February 21, 2012 19:43 — forked from pamelafox/exportjson.js
Google Spreadsheet JSON Export
// Exports current sheet as JSON and displays in message box.
function exportJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var rowsData = getRowsData(sheet);
ss.msgBox(Utilities.jsonStringify(rowsData));
}
// getRowsData iterates row by row in the input range and returns an array of objects.
// Each object contains all the data for a given row, indexed by its normalized column name.
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';