Skip to content

Instantly share code, notes, and snippets.

@Rich86man
Rich86man / git_files.sh
Created July 9, 2018 18:01
Find out what files someone is working on
git log --reverse --no-merges --author="AUTHOR" --name-only --pretty=format:""
@Rich86man
Rich86man / pbuniqsort.rb
Created July 3, 2018 19:20
How do I unique and sort my pasteboard
IO.popen('pbcopy', 'w') { |f| f << `pbpaste`.split('\n').uniq.sort.join('\n') }
@Rich86man
Rich86man / Colors.h
Created October 9, 2016 17:54
Colors
@interface UIColor (Orchestra)
+ (UIColor *)fitnessBlue;
+ (UIColor *)vitalsRed;
+ (UIColor *)bodyMeasurementsGray;
@end
typedef NS_ENUM(NSUInteger, RoomState) {
RoomStateActive,
RoomStatePendingCompletion,
RoomStateCompleted
};
@interface SCRoom : RLMObject
@property NSNumber<RLMInt> *serverId;
@property NSString *name;
@property NSString *providerName;
@Rich86man
Rich86man / gist:7548e47a5ee48ea5144e
Created March 7, 2016 20:01
Fix pod info.plist versions to pass ITC Verification
post_install do |installer|
plist_buddy = "/usr/libexec/PlistBuddy"
installer.pods_project.targets.each do |target|
plist = "Pods/Target Support Files/#{target}/Info.plist"
version = `#{plist_buddy} -c "Print CFBundleShortVersionString" "#{plist}"`.strip
stripped_version = /([\d\.]+)/.match(version).captures[0]
@Rich86man
Rich86man / TwitterTransitionAnimation.swift
Created February 9, 2016 20:01
Twitter transition with snapshot views
//
// TwitterTransitionAnimation.swift
// TransitionTreasury
//
// Created by DianQK on 12/20/15.
// Copyright © 2015 TransitionTreasury. All rights reserved.
//
import UIKit
/// Like Twitter Present.
@Rich86man
Rich86man / NSNotificationCenterExtensions.swift
Last active November 3, 2017 21:50 — forked from jverkoey/NSNotificationCenterExtensions.swift
NSNotificationCenter extension for safe Swift instance method support
/*
Copyright (c) 2011-present, NimbusKit. All rights reserved.
This source code is licensed under the BSD-style license found at http://nimbuskit.info/license
Extracted from NimbusKit: Swift Edition at https://github.com/nimbuskit/swift
*/
extension NSNotificationCenter {
/**
@Rich86man
Rich86man / gist:60a89ec8d93c5a16a834
Created July 6, 2015 17:26
bulk upload $signups
require 'rubygems'
require 'mixpanel_client'
client = Mixpanel::Client.new( api_key: '',api_secret: '')
require 'base64' # co-located with the Base64 call below for clarity
User.all.each {|u|
data_to_import = {'event' => 'firstLogin2', 'properties' => {'distinct_id' => "#{u.id}", 'time' => "#{u.created_at}", 'token' => 'a9a9239a31dd7b497d0db66f861f8b33'}}
@Rich86man
Rich86man / import.rake
Last active August 29, 2015 14:19 — forked from abstractcoder/import.rake
Import heroku database
namespace :db do
desc "Backs up heroku database and restores it locally"
task clong: :environment do
# Load the current environments database config
c = Rails.configuration.database_configuration[Rails.env]
# This gets around an issue with the Heroku Toolbelt
# https://github.com/sstephenson/rbenv/issues/400#issuecomment-18742700
# https://github.com/sstephenson/rbenv/issues/400#issuecomment-18744931
Bundler.with_clean_env do
- (void)focusWithMode:(AVCaptureFocusMode)focusMode exposeWithMode:(AVCaptureExposureMode)exposureMode atDevicePoint:(CGPoint)point monitorSubjectAreaChange:(BOOL)monitorSubjectAreaChange
{
dispatch_async([self sessionQueue], ^{
AVCaptureDevice *device = [[self videoDeviceInput] device];
NSError *error = nil;
if ([device lockForConfiguration:&error]) {
if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:focusMode]) {
[device setFocusMode:focusMode];
[device setFocusPointOfInterest:point];
}