Skip to content

Instantly share code, notes, and snippets.

View NSURLSession0's full-sized avatar

NSURLSession NSURLSession0

  • The Netherlands
View GitHub Profile
@NSURLSession0
NSURLSession0 / project.yml
Created July 28, 2022 16:09
XcodeGen WidgetKit
...
WidgetsExtension:
type: app-extension
platform: iOS
settings:
PRODUCT_BUNDLE_IDENTIFIER: "com......widgets"
info:
path: src/Widgets/Info.plist
properties:
NSExtension:
@NSURLSession0
NSURLSession0 / Node-RED Export
Created December 27, 2021 23:47
Aqara Magic Cube (Xiaomi) Node-RED function
[{"id":"6335da097f800869","type":"function","z":"c3639465.ce006","name":"Magic Cube Action","func":"const code = msg.payload.event.event;\n\nconst codes = {\n\t\"side1\": [1002, 1003, 1004, 1005, 1006],\n\t\"side2\": [2001, 2003, 2004, 2005, 2006],\n\t\"side3\": [3001, 3002, 3004, 3005, 3006],\n\t\"side4\": [4001, 4002, 4003, 4005, 4006],\n\t\"side5\": [5001, 5002, 5003, 5004, 5006],\n\t\"side6\": [6001, 6002, 6003, 6004, 6005],\n\t\"push\": [1000, 2000, 3000, 4000, 5000, 6000],\n\t\"doubletap\": [1001, 2002, 3003, 4004, 5005, 6006],\n\t\"shake\": [7007],\n\t\"drop\": [7008],\n\t\"wake\": [7000]\n};\n\nconst outputIndexPerAction = {\n \"side1\": 0,\n \"side2\": 1,\n \"side3\": 2,\n \"side4\": 3,\n \"side5\": 4,\n \"side6\": 5,\n \"push\": 6,\n \"doubletap\": 7,\n \"shake\": 8,\n \"drop\": 9,\n \"rotatecw\": 10,\n \"rotateccw\": 11,\n \"wake\": 12\n}\n\nlet action;\n\nfor (let a in codes) {\n\tif (codes[a].includes(code)) {\n\t\taction = a;\n\t\tbreak;\n\t}\n}\n\nif (!act
@NSURLSession0
NSURLSession0 / keybase.md
Last active April 30, 2021 12:10
keybase.md

Keybase proof

I hereby claim:

  • I am Mauricevb on github.
  • I am mauricevb (https://keybase.io/mauricevb) on keybase.
  • I have a public key whose fingerprint is FAB9 DCD7 2571 DBAA DAAB 0309 BD2F 12A3 5CA6 E72B

To claim this, I am signing this object:

#
# Mac Setup
# 2020-12-22
#
# Install Xcode Command Line Tools
echo "Installing Xcode Command Line Tools..."
xcode-select --install
# Install Homebrew if we don't have it
@NSURLSession0
NSURLSession0 / viewcontroller.swift
Created June 6, 2016 12:56
tvOS detect tabbar show/hide in Swift
override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) {
let prevFocusViewClassName = NSStringFromClass(context.previouslyFocusedView!.classForCoder)
let nextFocusedView = NSStringFromClass(context.nextFocusedView!.classForCoder)
let barButtonName = "UITabBarButton"
if prevFocusViewClassName == barButtonName && nextFocusedView != barButtonName {
// Tabbar disappeared
} else if prevFocusViewClassName != barButtonName && nextFocusedView == barButtonName {
// Tabbar appeared
}
@NSURLSession0
NSURLSession0 / cloudkit-server.php
Created February 7, 2016 21:36
CloudKit server-to-server in PHP
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';