This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace GlobalHotKey | |
{ | |
public class GlobalKeyboardHookEventArgs : HandledEventArgs | |
{ | |
public GlobalKeyboardHook.KeyboardState KeyboardState { get; private set; } | |
public GlobalKeyboardHook.LowLevelKeyboardInputEvent KeyboardData { get; private set; } | |
public GlobalKeyboardHookEventArgs( | |
GlobalKeyboardHook.LowLevelKeyboardInputEvent keyboardData, | |
GlobalKeyboardHook.KeyboardState keyboardState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Example() { | |
// Crap, we just made a Firebase query for each render instead of | |
// what we wanted, a query set up on mount, and cleaned up on unmount | |
const query = useQuery(db.collections('lots-of-stuff').limit(10000)); | |
return <ul>query.docs.map(x => (<li>{x}</li>)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Model } from '@whenjs/when'; | |
import { useState } from 'react'; | |
import { useWhen } from '../src/when-react/use-helpers'; | |
class ViewModel extends Model { | |
public foo: number; | |
constructor() { | |
super(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Model, when } from '@whenjs/when'; | |
import { scan } from 'rxjs/operators'; | |
import { useState } from 'react'; | |
import { useObservable } from '../src/when-react/use-helpers'; | |
class ViewModel extends Model { | |
public foo: number; | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function main() { | |
const sock = create('ws://localhost:8123'); | |
sock.connect(); | |
await sock.auth('sekrit code'); | |
const ha = new HomeAssistant(sock); | |
const light = new Light(ha, 'hue_lamp_1'); | |
// light.state will always give you the initial value on subscribe | |
light.state.subscribe(x => console.log(x)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { create } from './websocket-ha'; | |
const homeAssistant = create('http://localhost:8123'); | |
homeAssistant.connect(); | |
await homeAssistant.auth("my secret password"); | |
// Make API calls | |
console.log(await homeAssistant.call({type: 'get_config'})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
* Copyright 2018 Google LLC. All Rights Reserved. | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git branch --merged | while read line | |
do | |
# If the line is in the format '* master' (indicating the current branch), | |
# this will be effectively empty, so we don't somehow delete the current | |
# branch | |
BRANCH=`echo "$line" | awk -F '*' '{ print $1 }'` | |
if [ -z "$BRANCH" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var watchThatWindow = new ObservableWindow(); | |
watchThatWindow.WindowCreated | |
.Select(hwnd => NativeMethods.GetWindowTitle(hwnd)) | |
.Subscribe(x => Console.WriteLine($"Say hello to '{x}'!")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity | |
import android.bluetooth.BluetoothGattCharacteristic | |
import android.os.Bundle | |
import android.util.Log | |
import com.github.ivbaranov.rxbluetooth.RxBluetooth | |
import com.polidea.rxandroidble.RxBleClient | |
import com.polidea.rxandroidble.RxBleConnection | |
import com.polidea.rxandroidble.RxBleDevice | |
import com.polidea.rxandroidble.scan.ScanSettings | |
import rx.Observable |