Skip to content

Instantly share code, notes, and snippets.

View dlinsin's full-sized avatar

David Linsin dlinsin

View GitHub Profile
@adamcbuckley
adamcbuckley / VersionNumberComparator.java
Created January 16, 2020 17:37
A java.util.Comparator for version (or chapter) numbers, which have an arbitrary number of decimal points.
package com.hebdensoft;
import java.util.Comparator;
/**
* <p>A java.util.Comparator for version (or chapter) numbers, which have an arbitrary number of decimal points.</p>
* <p>The code was taken from https://bugs.openjdk.java.net/browse/JDK-8134512 and http://cr.openjdk.java.net/~igerasim/8134512/04/webrev/index.html</p>
* <p>How to use:</p>
* <p><code>myListOfVersionNumbers.sort(VersionNumberComparator.getInstance());</code></p>
@merikan
merikan / Jenkinsfile
Last active November 4, 2024 08:05
Some Jenkinsfile examples
Some Jenkinsfile examples
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import java.util.concurrent.CountDownLatch;
/**
* File Created by gouravd on 17/08/16.
@gomfunkel
gomfunkel / elgato-eve.md
Last active October 29, 2024 19:01
Elgato Eve HomeKit Services & Characteristics

Elgato Eve HomeKit Services & Characteristics

A work in progress collection of proprietary and as of yet undocumented HomeKit characteristics and their UUIDs used by Elgato Eve.

This list is not including all Eve accessories available and some services and characteristics still make no sense to me. If you have anything to contribute, please leave a comment. There is no guarantee that the information listed below is correct.

Elgato Eve Energy (Firmware Revision 1.3.1;466)

Service - Characteristic UUID R W Type Description
@steve228uk
steve228uk / gist:1fc2a1fe475e3f3a7ee9
Created October 16, 2015 11:14
Transparent tvOS modal
providesPresentationContextTransitionStyle = true
definesPresentationContext = true
modalVc.modalPresentationStyle = .OverCurrentContext
presentViewController(modalVc, animated: true, completion: nil)
@guilhermearaujo
guilhermearaujo / README.md
Last active July 27, 2022 09:36
OCLint integration with Xcode

OCLint integration with Xcode

1. Integration

  • Add a new Target of kind Aggregate, name it OCLint
  • Under Builde Phases, add a new Run Script Phase
  • Paste the script

2. Usage

  • Select target OCLint
  • Build the target (press ⌘+B)
@drewmccormack
drewmccormack / gist:250542102aa77d700195
Created February 25, 2015 14:40
Determine if a CGImage is fully opaque
BOOL CGImageIsOpaque(CGImageRef image)
{
size_t width = CGImageGetWidth(image);
size_t height = CGImageGetHeight(image);
unsigned char pixelData[width * height];
CGContextRef context = CGBitmapContextCreate( pixelData, width, height, 8, width, NULL, (kCGBitmapAlphaInfoMask & kCGImageAlphaOnly) );
CGContextDrawImage( context, CGRectMake(0, 0, width, height), image );
CGContextRelease( context );
for (NSInteger i = 0; i < width * height; ++i) {
//
// JumpFixTableViewController.swift
//
// Created by Indragie on 1/3/15.
// Copyright (c) 2015 Indragie Karunaratne. All rights reserved.
//
import UIKit
/// Table view controller that implements a workaround for a bug where
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
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
@indragiek
indragiek / DynamicTypeLabel.swift
Last active August 25, 2017 15:08
UILabel subclass that automatically adjusts the font when the global dynamic type setting changes.
//
// DynamicTypeLabel.swift
//
// Created by Indragie on 10/16/14.
// Copyright (c) 2014 Indragie Karunaratne. All rights reserved.
//
import UIKit
class DynamicTypeLabel : UILabel {