Skip to content

Instantly share code, notes, and snippets.

View larsacus's full-sized avatar

Lars Anderson larsacus

View GitHub Profile
@sforshee
sforshee / erl3-example-config.txt
Last active April 7, 2023 22:46
Example configuration for Ubiquiti EdgeRouter Lite 3
# EdgeRouter Lite 3 configuration example based on the walkthroughs starting
# with
# http://www.forshee.me/2016/03/01/ubiquiti-edgerouter-lite-setup-part-1-the-basics.html.
#
# Demonstrates a network setup utilizing VLANs, a zone-based firewall, and
# an OpenVPN server. The network has VLANs to segregate home and home-office
# network traffic, plus a management VLAN for "smart" networking equipment.
# The office VLAN has administrative access to web and SSH interfaces on the
# router and the management VLAN whereas the home network does not.
#
import Cocoa
// for-in
func checkForIn(array: [Int], dict: [Int: String]) {
for num in array where dict[num] != nil {
num
}
}
checkForIn([1,2,3,4], dict: [1:"one", 2:"two"])
@smileyborg
smileyborg / Xcode7Macros.h
Last active May 26, 2020 12:08
Backwards compatible macros for Objective-C nullability annotations and generics
/**
* The following preprocessor macros can be used to adopt the new nullability annotations and generics
* features available in Xcode 7, while maintaining backwards compatibility with earlier versions of
* Xcode that do not support these features.
*/
#if __has_feature(nullability)
# define __ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
# define __ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
# define __NULLABLE nullable
@DimaVartanian
DimaVartanian / CrashlyticsSwift.Swift
Last active June 8, 2019 10:16
Crashlytics CLS_LOG() in Swift
//
// Created by Dima Vartanian on 10/29/15.
//
import Foundation
import Crashlytics
// this method gives us pretty much the same functionality as the CLS_LOG macro, but written as a Swift function, the only differences are that we have to use array syntax for the argument list and that we don't get see if the method being called is a class method or an instance method. We also have to define the DEBUG compiler flag with -D DEBUG.
/// Usage:
///
@steventroughtonsmith
steventroughtonsmith / NanoCompanion.m
Last active September 19, 2015 17:00
Load the Apple Watch Companion Settings Bundles into an app
//
// AppDelegate.m
// NanoCompanion
//
// Created by Steven Troughton-Smith on 13/01/2015.
// Copyright (c) 2015 High Caffeine Content. All rights reserved.
//
#import "AppDelegate.h"
#import "Aspects.h"
#import "fishhook.h"
#import <dlfcn.h>
// UIAnimationDragCoefficient
// UISimulatedApplicationResizeGestureEnabled
// UIExternalTouchSloppinessFactor
// UIEnableParallaxEffects
// UIDeviceUsesLowQualityGraphics
@ivira
ivira / gist:b701ac52dea93f6cb9da
Created October 29, 2014 16:16
Find dSYM by UUID, when mdfind doesn't work
find . -name '*.dSYM' -exec dwarfdump --uuid '{}' \; | grep <UUID>
@steipete
steipete / Warnings.xcconfig
Last active February 1, 2020 15:06
The warnings configuration we use in the PSPDFKit iOS framework - http://pspdfkit.com
//
// Warnings.xcconfig
//
// The list of warnings we (don’t) use, and the reasons why.
//
// :MARK: Warnings in use:
// :MARK: -everything
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us.
//
// :MARK: - Warnings not to be promoted:
@matthiasplappert
matthiasplappert / gist:9493050
Last active August 29, 2015 13:57
QuickLook Debugging for `UIView`
@interface UIView (MPAdditions)
@end
@implementation UIView (MPAdditions)
- (id)debugQuickLookObject {
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) {
return nil;
}
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.