Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yaronalk
yaronalk / UIView+Wiggle.h
Last active May 19, 2019 14:43
Make any UIView (e.g., UICollectionViewCell) wiggle like iOS home screen apps before being deleted
//
// UIView+Wiggle.h
//
@interface UIView (Wiggle)
- (void)wiggle;
- (void)endWiggling;
- (BOOL)isWiggling;
@fareast555
fareast555 / MPC_NSOperation.h
Last active November 19, 2020 16:46
A sub-classable NSOperation subclass useful for NSOperationQueues connected by adapter blocks, followed by a convenience NSOperationQueue category to wire your custom MPC_NSOperation and NSBlockOperations together.
//
// MPC_NSOperation.h
//
// Created by Michael Critchley on 2017/11/14.
// Copyright © 2017 Michael Critchley. All rights reserved.
//*****************
//This is the parent class for all MPC_NSOperation objects.
//To use:
//1. Subclass this method
@mayoff
mayoff / Main.storyboard
Created September 10, 2014 15:04
Storyboard with autolayout constraints for aspect-fit of a subview in a container view, for http://stackoverflow.com/a/25768875/77567
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
@mwaterfall
mwaterfall / gist:953664
Created May 3, 2011 16:28
NSDate from Internet Date & Time String
//
// NSDate+InternetDateTime.h
// MWFeedParser
//
// Created by Michael Waterfall on 07/10/2010.
// Copyright 2010 Michael Waterfall. All rights reserved.
//
#import <Foundation/Foundation.h>
@tubalainen
tubalainen / gist:e36a5f6ca44593f2ca306a33e90d7398
Last active June 2, 2023 22:23
FTX temperature sensor and relay control
At home I have a dumb Östberg Heru 75 with no smartness what so ever, it is also a bit unclear how efficient the system really is. How much heat that can be recycled.
The components (other than the tools, 3D printed box for the electronics etc)
1x NodeMCU (I use a LUA board), can be found on all tinker shops and all big online retail stores such as ali, banggood, amazon and ebay as well as locally sourced supplers (prefered!)
4x Dallas temperature sensors DS18B20 "waterproofed with metal sleeve". Souced from same as the NodeMCU
1x relay board, souced from the same as the NodeMCU
Some cables
For the project installation of the software
- Install esphome (addon store in Home Assistant)
@yaronalk
yaronalk / gist:c9ee61b1ff19d9db20dc038a88680e44
Last active November 19, 2023 11:54
Quick-n'-Dirty צבע אדום alerts in Home Assistant
rest:
- resource: https://www.oref.org.il/WarningMessages/History/AlertsHistory.json
scan_interval: 3
binary_sensor:
- name: "Red Alert צבע אדום"
device_class: safety
value_template: >
{% set homeCitiesTf = 'כפר עזה ,בצת' %}
{%- set ns = namespace() -%}
{%- set ns.output=[]-%}
@the-moog
the-moog / cards.c
Created June 20, 2022 13:24
Sidestepping limitation of variable length member of fixed array sizes
#include <stdio.h> // for printf
#include <string.h> // for strcmp
// Define a card
typedef struct card
{
int value; // This is an int, so it's storage size does not change
char * name; // This is a pointer, so it's storange size does not change
int rule_change;
} card_t;
@liads
liads / ElectraClimate.h
Created June 16, 2019 20:53
ESPHome climate component for Electra AC (RC-3 IR remote)
#include "esphome.h"
static const char *TAG = "electra.climate";
typedef enum IRElectraMode {
IRElectraModeCool = 0b001,
IRElectraModeHeat = 0b010,
IRElectraModeAuto = 0b011,
IRElectraModeDry = 0b100,
IRElectraModeFan = 0b101,
@maciekish
maciekish / resetXcode.sh
Created August 10, 2016 10:13
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/bin/bash
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/Library/Caches/com.apple.dt.Xcode/*
open /Applications/Xcode.app
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \