Skip to content

Instantly share code, notes, and snippets.

View mmackh's full-sized avatar

Maximilian Mackh mmackh

View GitHub Profile
import BaseComponents
class LayoutViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.addSplitView { splitView in
splitView.addSplitView(configurationHandler: { splitView in
splitView.direction = .horizontal
@mmackh
mmackh / PasteboardHelper.h
Last active April 4, 2022 07:58
PasteboardHelper - Load .eml files from Mail.app (macOS)
//
// PasteboardHelper.h
// Spaceboard
//
// Created by mmackh on 28.03.22.
//
#import <Foundation/Foundation.h>
@class PasteboardHelperPromiseResolveRequest;
@mmackh
mmackh / woocommerce_extension.php
Last active July 8, 2021 08:51
Role Based Pricing - Manual Order
function woocommerce_ajax_add_order_item_meta( $item_id, $raw_item, $order ) {
$product = $raw_item->get_product();
$rolePrices = $product->get_meta('_role_based_price' );
if (!$rolePrices) return;
$userRole = array_shift($order->get_user()->roles);
if (!isset($rolePrices[$userRole])) return;
$grossPrice = $product->get_price_including_tax();
$netPrice = $product->get_price_excluding_tax();
  1. Created an iFrame on the product page with the content 'Loading...' to adjust the styling to fit the page
  2. Added iFrame to top of product page on Mobile, adjusted properties to collapsed & hidden on page load
  3. Added custom JS code that will check if: Mobile, Product Page URL contains appropriate model substring.
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
@mmackh
mmackh / IPDFContextMenu.h
Last active May 31, 2020 23:55
NSMenu in Catalyst
//
// IPDFContextMenu.h
// InstaPDF
//
// Created by Maximilian Mackh on 02/02/15.
// Copyright (c) 2015 mackh ag. All rights reserved.
//
#import <Foundation/Foundation.h>
@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
@mmackh
mmackh / PCWebView.h
Last active April 13, 2017 09:48
PCWebView
//
// PCWebView.h
//
// Created by Maximilian Mackh on 25/03/2017.
// Note this Open Source class relies on PCSplitView.h found on Github
#import <UIKit/UIKit.h>
@interface PCWebView : UIView
@mmackh
mmackh / gist:e24f4ad31326e54a68f1
Created September 21, 2014 18:20
Change UIStatusBar Color
NSString *statusBarString = [NSString stringWithFormat:@"_s%@at%@sBar",@"t",@"u"];
NSString *colorKey = @"foregroundColor";
id statusBar = [application valueForKey:statusBarString];
if (statusBar && [statusBar respondsToSelector:NSSelectorFromString(colorKey)])
{
[statusBar setValue:[AFPConstantsColorGold colorWithAlphaComponent:0.5] forKey:colorKey];
}

Keybase proof

I hereby claim:

  • I am mmackh on github.
  • I am maxi (https://keybase.io/maxi) on keybase.
  • I have a public key whose fingerprint is 262F 8E5A F8AF 56AA 84BD F742 17E5 DA95 49FE 7E1B

To claim this, I am signing this object:

//
// PCMutableDirectory.h
// SmartOrderKit
//
// Created by Maximilian Mackh on 23/03/14.
// Copyright (c) 2014 Professional Consulting & Trading GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>