Skip to content

Instantly share code, notes, and snippets.

johndpope-karhoo

  • Karhoo
  • New York
Block or report user

Report or block johndpope-karhoo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View basicconstraints.swift
/*
ericasadun.com
Super-basic layout utilities
*/
#if os(OSX)
import Cocoa
public typealias View = NSView
@orj
orj / NSErrorUserInfoValueProviding.swift
Last active Oct 5, 2016
A protocol that can be adopted by ErrorType, RawRepresentable conforming types that provides a mechanism for providing NSError userInfo values.
View NSErrorUserInfoValueProviding.swift
/// A protocol that can be adopted by ErrorType, RawRepresentable conforming types that
/// provides a mechanism for providing NSError userInfo values.
///
/// There are nil returning default implementations of all of the members of this protocol.
protocol NSErrorUserInfoValueProviding {
var localizedDescription: String? { get }
var localizedFailureReason: String? { get }
var localizedRecoverySuggestion: String? { get }
var localizedRecoveryOptions: [String]? { get }
@Ashton-W
Ashton-W / .lldbinit
Created Apr 19, 2016
LLDB sim_location command (lldbinit)
View .lldbinit
command alias sim_location expr (void)NSLog(@"Printing Simulator App Paths:\n\nBundle:\n%@\n\nDocuments:\n%@\n\n", [[NSBundle mainBundle] resourcePath], [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] resourceSpecifier]);
@nicolas-miari
nicolas-miari / NSError+Shorthand.swift
Last active May 22, 2017
Swift extension that provides convenient shorthands for initializing `NSError` objects.
View NSError+Shorthand.swift
/**
Provides convenient shorthands for initializing `NSError` objects.
*/
extension NSError {
/**
Same as `init(domain:code:userInfo:)`, but `domain` defaults to the app's
bundle indentifier.
*/
convenience init(code: Int, userInfo: [NSObject : AnyObject]?) {
let bundleIdentifier = NSBundle.mainBundle().bundleIdentifier!
View mongo-notes.js
// MONGO COMMAND LINE
// start mongod
ulimit -n 2048 && mongod
// ctrl-c ends in same window, but can also use
killall mongod
// start mongod with data directory in another location
mongod -dbpath /path/to/data/dir
// open command line interface (mongo shell)
mongo
// restore a DB dump from a binary (BSON) dump file
@dalu93
dalu93 / Fastfile
Last active Sep 23, 2016
Fastfile example
View Fastfile
fastlane_version "1.49.0"
default_platform :ios
######################
slack_webhook = 'https://...' #See Slack Incoming Webhook
slack_default_channel = '#channel'
default_production_scheme = 'YOUR-PRODUCTION-SCHEME'
certificates_output_path = './certificates'
profiles_output_path = './profiles'
View inspect.py
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:
ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
View gist:7bfc388a8144ddbeaf5d

NSLog(@"%@", [[[UIApplication sharedApplication] keyWindow] performSelector:@selector(_autolayoutTrace)]);
po [[UIWindow keyWindow] _autolayoutTrace];

Cocoa layout example

UIViewShowAlignmentRects YES
UIViewShowAlignmentRects

@chanpory
chanpory / gist:21b7ee3a39c3f693a716
Last active Aug 31, 2016
Shell command to create a new tab in Mac OS X terminal
View gist:21b7ee3a39c3f693a716
# Opens a new tab in the current Terminal window and optionally executes a command.
# When invoked via a function named 'newwin', opens a new Terminal *window* instead.
# From http://stackoverflow.com/questions/7171725/open-new-terminal-tab-from-command-line-mac-os-x
newtab() {
# If this function was invoked directly by a function named 'newwin', we open a new *window* instead
# of a new tab in the existing window.
local funcName=$FUNCNAME
local targetType='tab'
@danthegoodman
danthegoodman / alert.sh
Last active Sep 2, 2016
iTerm niceties for bash
View alert.sh
# Sends a message to growl from the terminal
#
# Usage: alert <text>
# Result: Growl notification with text
#
# Example: sleep 10 ; alert 'I am awake'
alert() { echo -e $'\e]9;'${@}'\007' ; }
You can’t perform that action at this time.