Skip to content

Instantly share code, notes, and snippets.

View valvoline's full-sized avatar

Costantino Pistagna valvoline

View GitHub Profile
@valvoline
valvoline / TestHEIC.swift
Created November 14, 2018 20:52
A simple HEIC vs JPEG benchmark based on https://pspdfkit.com/blog/2018/ios-heic-performance/
//
// ViewController.swift
// TestHEIC
//
// Created by Costantino Pistagna on 14/11/2018.
// Copyright © 2018 sofapps. All rights reserved.
//
import UIKit
import AVFoundation
int chk = DHT.read22(DHT22_PIN);
switch (chk)
{
case DHTLIB_OK:
client.print("{ \"temperature\":");
client.print(DHT.temperature-2);
client.print(", \"humidity\":");
client.print(DHT.humidity);
client.println("}");
break;
/*
A simple HomeBridgeHub example for HomeBridge
Author: Costantino Pistagna <[email protected]>
*/
#include <dht.h>
#include <Bridge.h>
#include <BridgeServer.h>
#include <BridgeClient.h>
digitalWrite(7, HIGH);
delay(2000);
digitalWrite(7, LOW);
{
"bridge": {
"name": "Home1bridge",
"username": "CD:32:D2:E1:CC:33",
"port": 50800,
"pin": "031-43-153"
},
"description": "This is an example configuration file.",
@valvoline
valvoline / UIImageView+URLRequest.swift
Created November 9, 2017 10:15
UIImageView extension specifically designed for UITableViewCell integration, setting also the highlighted corresponding image for seamlessly integration.
//
// UIImageView+URLRequest.swift
//
// Created by Costantino Pistagna on 06/11/2017.
// Copyright © 2017 Sofapps. All rights reserved.
//
import UIKit
import Foundation
@valvoline
valvoline / String+HTML.swift
Created November 8, 2017 18:31
A swift string extension to deal with HTML
//
// String+HTML.swift
// AttributedString
//
// Created by Costantino Pistagna on 08/11/2017.
// Copyright © 2017 sofapps.it All rights reserved.
//
import UIKit
import Foundation
//
// Array+Utilities.swift
//
// Created by Costantino Pistagna on 26/07/16.
//
import Foundation
extension Array {
mutating func removeObject<T where T : Equatable>(obj: T) {
self = self.filter({$0 as? T != obj})
//
// Created by Costantino Pistagna on 08/02/2017.
// Copyright © 2017 sofapps. All rights reserved.
//
func integerWithBytes<T: IntegerType where T: ByteConvertible, T: BitshiftOperationsType>
(bytes: [UInt8]) -> T?
{
if bytes.count != sizeof(T) {
return nil
//
// CIRotateFilter.h
// Touches
//
// Created by valvoline on 05/01/16.
// Copyright © 2016 valvoline. All rights reserved.
//
#import <CoreImage/CoreImage.h>