Skip to content

Instantly share code, notes, and snippets.

View mattpodwysocki's full-sized avatar

Matthew Podwysocki mattpodwysocki

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using SQLite;
namespace MobCat.Data.Repositories
{
public interface IDataRepository<TEntity> : IDisposable where TEntity : class
{
ICollection<TEntity> Find(
Expression<Func<TEntity, bool>> criteria,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "");
Task<ICollection<TEntity>> FindAsync(
Expression<Func<TEntity, bool>> criteria,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "");
import { AsyncObserver, AsyncObserverX } from './asyncobserver';
import { AsyncObservable, AsyncObservableX } from './asyncobservable';
import { AsyncSubscription } from './asyncsubscription';
import { AsyncSubscriptionX } from './subscriptions/asyncsubscriptionx';
import { CompositeAsyncSubscription } from './subscriptions/compositeasyncsubscription';
import { BinarySubscription } from './subscriptions/stablecompositeasyncsubscription';
import { SingleAssignmentAsyncSubscription } from './subscriptions/singleassignmentasyncsubscription';
import { bindCallback } from '../internal/bindcallback';
class InnerObserver<T, R> extends AsyncObserverX<R> {
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew upgrade;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
import { identity, identityAsync } from '../internal/identity';
// tslint:disable-next-line:no-empty
const NEVER_PROMISE = new Promise(() => {});
type MergeResult<T> = { value: T; index: number };
function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) {
return promise.then(value => ({ value, index })) as Promise<MergeResult<T>>;
}
import { identity } from '../internal/identity';
// tslint:disable-next-line:no-empty
const NEVER_PROMISE = new Promise(() => {});
type MergeResult<T> = { value: T; index: number };
function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) {
return promise.then(value => ({ value, index })) as Promise<MergeResult<T>>;
}
import { AsyncIterableX } from './asynciterablex';
import { identity } from '../internal/identity';
// tslint:disable-next-line:no-empty
const NEVER_PROMISE = new Promise(() => {});
type MergeResult<T> = { value: T; index: number };
function wrapPromiseWithIndex<T>(promise: Promise<T>, index: number) {
return promise.then(value => ({ value, index })) as Promise<MergeResult<T>>;
import { Readable } from 'stream';
import { AsyncIterableX } from './asynciterablex';
enum StreamState {
NonFlowing,
Readable,
Ended,
Errored
}
'use strict';
export abstract class AceOfBase {
private _eyesOpen: boolean = false;
openEyes(): void {
this._eyesOpen = true;
}
sawSign(): boolean {
import { AsyncIterableX } from '../asynciterable';
import { AsyncSink } from '../asyncsink';
import { memoize } from './memoize';
export function asyncify<TSource>(
func: Function
): (...args: any[]) => AsyncIterableX<TSource> {
return function(...args: any[]) {
const sink = new AsyncSink<TSource>();