Skip to content

Instantly share code, notes, and snippets.

View tettoffensive's full-sized avatar

Stuart Tett tettoffensive

View GitHub Profile
@tettoffensive
tettoffensive / copyFirestoreDB.js
Last active August 12, 2019 18:03 — forked from brunobraga95/copyFirestoreDB.js
Copy firestore database
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({
@tettoffensive
tettoffensive / GHRunLoopWatchdog.h
Created October 7, 2016 22:34 — forked from jspahrsummers/GHRunLoopWatchdog.h
A class for logging excessive blocking on the main thread
/// 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

1. Clone your fork:

git clone [email protected]: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 September 8, 2016 19:30 — forked from krin-san/iOSVersionCheck.h
NSProcessInfo-based iOS version check macro (iOS 8+)
#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 February 23, 2016 00:31
NSLayoutAnchor for 10.10/iOS8
//
// 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 December 11, 2015 21:46 — forked from anthonya1999/IOMobileFramebuffer.h
A recent disassembly of IOMobileFramebuffer framework
/* 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
@tettoffensive
tettoffensive / UIImage+Blur.h
Last active August 29, 2015 14:27 — forked from fmtonakai/UIImage+Blur.h
UIImage Blur
//
// UIImage+Blur.h
// HTTPLoaderTest
//
// Created by masaki.fuke on 12/08/14.
// Copyright (c) 2012年 masaki.fuke. All rights reserved.
//
#import <UIKit/UIKit.h>
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d