Skip to content

Instantly share code, notes, and snippets.

View sgl0v's full-sized avatar

Max sgl0v

View GitHub Profile
@sgl0v
sgl0v / install_ruby_with_rbenv.md
Created June 15, 2021 11:16 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

@sgl0v
sgl0v / CoreDataController.swift
Created November 9, 2017 21:59 — forked from kharrison/CoreDataController.swift
Swift wrapper for NSPersistentContainer - Easy Core Data Setup with iOS 10
//
// CoreDataController.swift
//
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
@sgl0v
sgl0v / create_framework.sh
Created October 10, 2017 15:44 — forked from syshen/gist:c24d127e1adc2783e0e7
Universal framework
######################
# Options
######################
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
@sgl0v
sgl0v / Breakpoints_v2.xcbkptlist
Created January 4, 2016 10:03 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@sgl0v
sgl0v / gist:602be267b75b8303ceea
Created January 3, 2016 12:21 — forked from krzysztofzablocki/gist:4396302
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
@sgl0v
sgl0v / JAZMusician.h
Created November 24, 2015 23:22 — forked from jpsim/JAZMusician.h
SourceKit Playground
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.
@sgl0v
sgl0v / gist:3509f3ae628f4047cdb6
Created October 28, 2015 12:56 — forked from macguru/gist:b7a01e3f0e9ae6f350d5
Interface sizes a regular Universal app must support with iOS 9.2 when supporting all devices. Starts with iPhone 4s and goes up to iPad Pro.
COMPACT WIDTH (stacked view)
- 320 x 480 pt
-> iPhone 4s
- 320 x 568 pt
-> iPhone 5, 5s
- 320 x 768 pt
-> iPad Slideover Landscape
-> iPad Split Landscape 2/3 right
- 320 x 1024 pt

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

static Boolean PSPDFCaseInsensitiveEqualCallback(const void *a, const void *b) {
id objA = (__bridge id)a, objB = (__bridge id)b;
Boolean ret = FALSE;
if ([objA isKindOfClass:NSString.class] && [objB isKindOfClass:NSString.class]) {
ret = ([objA compare:objB options:NSCaseInsensitiveSearch|NSLiteralSearch] == NSOrderedSame);
}else {
ret = [objA isEqual:objB];
}
return ret;
}
#import <UIKit/UIKit.h>
@interface UIView (TLLayout)
@property (nonatomic, strong) NSArray *hiddenConstraints;
// set hidden and remove any constraints involving this view from its superview
- (void)hideAndRemoveConstraints;
- (void)showAndRestoreConstraints;