Skip to content

Instantly share code, notes, and snippets.

View mmackh's full-sized avatar

Maximilian Mackh mmackh

View GitHub Profile
@mmackh
mmackh / delegate.m
Last active October 29, 2019 14:39
Catalyst - NSToolbar Search
static NSString * toolbarIdentifierSearch = @"Search";
@interface IPDFToolbarItem : NSToolbarItem
@property (atomic,readwrite) id view;
@property CGSize minSize;
@property CGSize maxSize;
@end
@jabenninghoff
jabenninghoff / osx-vnc-hidden-options.md
Last active March 15, 2024 11:40
RemoteManagement "hidden" options

macOS Sierra (and possibly earlier) has some "hidden" screen sharing options:

If you're connecting to VNC using ssh tunneling, you can force macOS to listen only on localhost:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement.plist VNCOnlyLocalConnections -bool yes

In newer versions of macOS, screen sharing will automatically re-lock the screen when you disconnect if it was locked when you first connected. To change this behavior, use:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO

@kublaios
kublaios / gist:f01cdf4369c86ddd6d71
Created June 27, 2014 06:46
Making a PEM File for iOS Push Notifications (From Ray Wenderlich's tutorial)
# Convert the .cer file into a .pem file:
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem
# Convert the private key’s .p12 file into a .pem file:
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem
# Finally, combine the certificate and key into a single .pem file
$ cat PushChatCert.pem PushChatKey.pem > ck.pem
# At this point it’s a good idea to test whether the certificate works.
@mmick66
mmick66 / UICollectionViewFlowLayoutCenterItem.m
Last active August 2, 2022 10:06
UICollectionViewFlowLayout with arbitrary sized Paging
#import "UICollectionViewFlowLayoutCenterItem.h"
@implementation UICollectionViewFlowLayoutCenterItem
- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
{
CGSize collectionViewSize = self.collectionView.bounds.size;
CGFloat proposedContentOffsetCenterX = proposedContentOffset.x + self.collectionView.bounds.size.width * 0.5f;
CGRect proposedRect = self.collectionView.bounds;
@mmackh
mmackh / NSString+Additions.h
Last active January 19, 2017 23:12
Personal NSString Additions
//
// NSString+Hash.h
// Orbitink
//
// Created by mmackh on 5/3/13.
// Copyright (c) 2013 Professional Consulting & Trading GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@jakedahn
jakedahn / readability.js
Created March 16, 2011 08:28
Readability.js
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */
var dbg = (typeof console !== 'undefined') ? function(s) {
console.log("Readability: " + s);
} : function() {};
/*
* Readability. An Arc90 Lab Experiment.
* Website: http://lab.arc90.com/experiments/readability