Skip to content

Instantly share code, notes, and snippets.

View anaisbetts's full-sized avatar

Ani Betts anaisbetts

View GitHub Profile
> JustTheGame.dll!JustTheGame.LicensePromptViewModel..ctor.AnonymousMethod__18_5(Akavache.LoginInfo _) Line 67 C#
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.Do<Akavache.LoginInfo>.Actions._.OnNext(Akavache.LoginInfo value) Line 158 C#
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.Select<System.__Canon, System.__Canon>.Selector._.OnNext(System.__Canon value) Line 48 C#
System.Reactive.dll!System.Reactive.SafeObserver<JustTheGame.GameStoreHeuristicInfo>.WrappingSafeObserver.OnNext(JustTheGame.GameStoreHeuristicInfo value) Line 31 C#
System.Reactive.dll!System.Reactive.Linq.ObservableImpl.Select<ReactiveUI.ReactiveCommand<System.Reactive.Unit, System.__Canon>.ExecutionInfo, System.__Canon>.Selector._.OnNext(ReactiveUI.ReactiveCommand<System.Reactive.Unit, System.__Canon>.ExecutionInfo value) Line 48 C#
System.Reactive.dll!System.Reactive.Sink<ReactiveUI.ReactiveCommand<System.Reactive.Unit, JustTheGame.GameStoreHeuristicInfo>.ExecutionInfo>.ForwardOnNext(ReactiveUI.ReactiveComman
@anaisbetts
anaisbetts / index.ts
Created August 31, 2019 00:03
Create a PostgreSQL + Hasura database in Docker with Pulumi
import * as pulumi from '@pulumi/pulumi';
import * as docker from '@pulumi/docker';
import * as pg from '@pulumi/postgresql';
const cfg = new pulumi.Config();
const network = new docker.Network('net');
const pgImg = new docker.RemoteImage('postgresql-image', {
name: 'postgres:11',
keepLocally: true
@anaisbetts
anaisbetts / index.ts
Created August 30, 2019 05:27
PostgreSQL + Pulumi
import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
import * as pg from '@pulumi/postgresql';
const cfg = new pulumi.Config();
const network = new docker.Network("net");
const pgImg = new docker.RemoteImage("postgresql-image", {
name: "postgres:11",
keepLocally: true
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)
@anaisbetts
anaisbetts / example.ts
Last active January 20, 2019 04:37
always use function parameters
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>));
}
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();
@anaisbetts
anaisbetts / example.tsx
Created January 13, 2019 04:49
RxJS + React Hooks
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() {
@anaisbetts
anaisbetts / example.ts
Created August 27, 2018 04:46
RxJS + Home Assistant using When
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));
@anaisbetts
anaisbetts / example.ts
Created August 26, 2018 20:44
RxJS + Home Assistant
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'}));
/**
* @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