Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Stuart Tett tettoffensive

🎯
Focusing
Block or report user

Report or block tettoffensive

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
@tettoffensive
tettoffensive / copyFirestoreDB.js
Last active Aug 12, 2019 — forked from brunobraga95/copyFirestoreDB.js
Copy firestore database
View copyFirestoreDB.js
const firebase = require('firebase-admin');
var serviceAccountSource = require("./source.json"); // source DB key
var serviceAccountDestination = require("./destination.json"); // destination DB key
const sourceAdmin = firebase.initializeApp({
credential: firebase.credential.cert(serviceAccountSource)
});
const destinationAdmin = firebase.initializeApp({
View Master the Egg I: The Fry.md

Ingredients

  1. 1 Egg
  2. Salt
  3. Butter, Duck Fat

Steps

  1. Heat your skillet on medium for a few minutes
  2. Add your fat. If the fat is smoking, pull back on the heat
  3. Crack the egg into the pan
  4. Sprinkle salt on the egg
@tettoffensive
tettoffensive / UIAlertAction+Swizzle.swift
Created Apr 7, 2017
How to Swizzle what looks like an init method in Swift that's really a class method in Obj-C
View UIAlertAction+Swizzle.swift
typealias UIAlertActionHandler = ((UIAlertAction) -> Swift.Void)?
private struct AssociatedKeys {
static var handler = "cc_handler"
}
private let swizzling: (UIAlertAction.Type) -> () = { action in
// in swift this looks like an init, but in obj-c it's really actionWithTitle:style:handler class method
let originalSelector = #selector(UIAlertAction.init(title:style:handler:))
let swizzledSelector = #selector(UIAlertAction.action(testTitle:style:handler:)) // so swizzling an init won't work. we have to use another class method
@tettoffensive
tettoffensive / # infer - 2016-11-07_17-21-10.txt
Created Nov 8, 2016
infer on macOS 10.12 - Homebrew build logs
View # infer - 2016-11-07_17-21-10.txt
Homebrew build logs for infer on macOS 10.12
Build date: 2016-11-07 17:21:10
@tettoffensive
tettoffensive / GHRunLoopWatchdog.h
Created Oct 7, 2016 — forked from jspahrsummers/GHRunLoopWatchdog.h
A class for logging excessive blocking on the main thread
View GHRunLoopWatchdog.h
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
View gist:cad1891323186d98968cdaadce864bd6

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@tettoffensive
tettoffensive / iOSVersionCheck.h
Created Sep 8, 2016 — forked from krin-san/iOSVersionCheck.h
NSProcessInfo-based iOS version check macro (iOS 8+)
View iOSVersionCheck.h
#define INC_SYSTEM_VERSION(v) ((NSOperatingSystemVersion){v.majorVersion, v.minorVersion + 1, 0})
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:v]
#define SYSTEM_VERSION_LESS_THAN(v) (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v))
#define SYSTEM_VERSION_EQUAL_TO(v) (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) && (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(INC_SYSTEM_VERSION(v))))
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) (SYSTEM_VERSION_LESS_THAN(v) || SYSTEM_VERSION_EQUAL_TO(v))
#define SYSTEM_VERSION_GREATER_THAN(v) (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) && (!SYSTEM_VERSION_EQUAL_TO(v)))
/*
// Manual logical check
NSOperatingSystemVersion v = (NSOperatingSystemVersion){8, 4, 0};
@tettoffensive
tettoffensive / Anchor.swift
Created Feb 23, 2016
NSLayoutAnchor for 10.10/iOS8
View Anchor.swift
//
// Anchor.swift
// AnchorTest
//
// Created by Jonathan Wight on 7/10/15.
// Copyright © 2015 schwa.io. All rights reserved.
//
#if os(OSX)
import AppKit
@tettoffensive
tettoffensive / IOMobileFramebuffer.h
Created Dec 11, 2015 — forked from anthonya1999/IOMobileFramebuffer.h
A recent disassembly of IOMobileFramebuffer framework
View IOMobileFramebuffer.h
/* You may have to include your IOSurface header to compile, because of the GetLayerDefaultSurface function. If you do not have it, you may just uncomment the typedef to an IOSurface below. */
#include <stdio.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
#define kIOMobileFramebufferError 0xE0000000
View UIImage+Blur.h
//
// UIImage+Blur.h
// HTTPLoaderTest
//
// Created by masaki.fuke on 12/08/14.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>
You can’t perform that action at this time.