Skip to content

Instantly share code, notes, and snippets.

View adamtarmstrong's full-sized avatar
🏠
Working from home

Adam T Armstrong adamtarmstrong

🏠
Working from home
View GitHub Profile
@Blackshome
Blackshome / sensor-light.yaml
Last active July 23, 2024 21:07
Home Assistant Sensor Light that can be used in Blueprints
blueprint:
name: Sensor Light
description: >
# 💡 Sensor Light
**Version: 7.0**
Your lighting experience, your way - take control and customize it to perfection! 💡✨
@davidsteppenbeck
davidsteppenbeck / PreviewProviderModifier.swift
Last active October 31, 2022 10:30
A SwiftUI view modifier for simple preview providers.
import SwiftUI
enum PreviewProviderMode: CaseIterable {
/// Use for a light appearance preview.
case lightMode
/// Use for a dark appearance preview.
case darkMode
import SwiftUI
import PlaygroundSupport
struct ShareSheet: View {
var body: some View {
VStack(spacing: 0) {
SheetHeaderView()
.padding()
Divider()
@fabiogiolito
fabiogiolito / FacebookReactions.swift
Last active August 11, 2022 15:25
Recreating Facebook Reactions with SwiftUI. Demo Video: https://twitter.com/fabiogiolito/status/1142226669471748096
//
// FacebookReactions.swift
//
// Created by Fabio Giolito on 10/06/2019.
// Follow me: https://twitter.com/fabiogiolito
//
import SwiftUI
struct FacebookReactions : View {
@JeremyLikness
JeremyLikness / BuildController.cs
Created February 1, 2019 18:59
Receiving an event grid event
[HttpPost]
public IActionResult Post([FromBody]EventGridEvent[] value)
{
if (value == null || value.Length != 1 || value[0].Data == null)
{
_logger.LogError("Bad event.");
return BadRequest();
}
_logger.LogInformation($"Received event with type {value[0].EventType}");
@hansemannn
hansemannn / app-utils.js
Last active October 15, 2019 20:16
Using ES7+ async/await in Appcelerator Titanium
export function showOptions (args) {
const title = args.title;
const message = args.message;
const options = args.options;
const destructive = args.destructive !== undefined ? args.destructive : -1;
let cancel = -1;
return new Promise((resolve, reject) => {
if (OS_IOS) {
options.push('Cancel');
@hansemannn
hansemannn / cache.js
Created December 12, 2018 10:19
Caching remote images in Titanium (asynchronously)
export default class Utils {
static loadCachedImageFromURL(url, cb) {
let filename;
try {
filename = url.substring(url.lastIndexOf('/') + 1);
} catch (err) {
cb(null);
}
@jasonkneen
jasonkneen / gitconfig
Created November 16, 2018 11:48
Getting release notes from Git logs
# drop this into your ./.gitconfig file
# usage
# $ git today
# $ git yesterday
# $ git since 18-11-01
#
# will display a list of formatted commits you can lift to use for release notes
[alias]
today = log --since=1am --pretty=format:"%C(blue)-\\ %s"
@hansemannn
hansemannn / liveview-from-cli.md
Last active December 9, 2022 17:12
Use LiveView from the Titanium CLI (without Studio)
  1. Install LiveView globally:
npm i -g liveview
  1. Change the ~/.titanium/config.json to include the CLI hook (under paths -> hook):
{
	"user": { ... },
	"app": { ... },
	"cli": { ... },
@hansemannn
hansemannn / TitaniumiOS12UserNotifications.js
Last active February 12, 2019 04:06
Use the iOS 12 UserNotifications API's (threadIdentifier, summaryArgument, summaryArgumentCount) in Titanium!
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var btn = Ti.UI.createButton({
title: 'Schedule Notification'
});
btn.addEventListener('click', function() {
schedule('id_1', 'New Notification', 'Hey there!', new Date().getTime() + 3000);