Skip to content

Instantly share code, notes, and snippets.

View DarkoKukovec's full-sized avatar

Darko Kukovec DarkoKukovec

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DarkoKukovec
DarkoKukovec / enum.ts
Last active December 29, 2019 16:13 — forked from rauschma/enum.ts
interface IEnum<T = void> {
key: string;
value: T;
}
interface IEnumConstructor<T = void> {
new(value: T): IEnum<T>;
enumKeys: Set<string>;
enumValues: Set<IEnum<T>>;
}
import { IJsonapiModel, IJsonapiView, Response } from 'datx-jsonapi';
import { useEffect, useMemo, useState } from 'react';
interface IResponseWithNext<T extends IJsonapiModel> extends Response<T> {
next: Promise<Response<T>>;
}
function responseHasNext(response: IResponseWithNext<IJsonapiModel>): true;
function responseHasNext(response?: Response<IJsonapiModel>): false;
function responseHasNext(response?: Response<IJsonapiModel> | IResponseWithNext<IJsonapiModel>): boolean {
import { Collection, IModelConstructor, View } from 'datx';
import { IJsonapiModel, IJsonapiView, IRequestOptions, jsonapi } from 'datx-jsonapi';
import { useEffect, useMemo, useState } from 'react';
const JsonapiView = jsonapi(View);
export const useFetchAll = <T extends IJsonapiModel>(
collection: Collection,
model: IModelConstructor<T>,
options?: IRequestOptions,
@DarkoKukovec
DarkoKukovec / infinite.tsx
Created December 27, 2018 14:10
HOC Component for datx-jsonapi
import { IJsonapiModel, IJsonapiView, Response } from 'datx-jsonapi';
import { IDictionary } from 'datx-utils';
import { action, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
type LoadingProps = {loading: IDictionary<boolean>} & {
[key: string]: IJsonapiView;
};
@DarkoKukovec
DarkoKukovec / injectApi.tsx
Created December 27, 2018 14:04
HOC Component for datx-jsonapi
import { IModelConstructor, IType, PureModel, View } from 'datx';
import { IJsonapiCollection, IJsonapiModel, IJsonapiView, IRequestOptions, jsonapi, Response } from 'datx-jsonapi';
import { observable, set } from 'mobx';
import * as React from 'react';
import { IDictionary } from '../interfaces/IDictionary';
const JsonapiView = jsonapi(View);
interface ILoaderDefinition {

Keybase proof

I hereby claim:

  • I am DarkoKukovec on github.
  • I am darko (https://keybase.io/darko) on keybase.
  • I have a public key whose fingerprint is 9EA6 CFFB 76BE 8CEE DD95 1A70 7BBE 136C F91A 1C65

To claim this, I am signing this object:

SEGMENT_SEPARATOR_LEFT="\ue0b0"
PRIM_PROMP_COLOR="blue"
ERR_PROMP_COLOR="red"
PROMP_FORMAT="%2c"
function __spacer_left() {
bg="%{$bg[$1]%}"
fg="%{$fg[$2]%}"
print -n "$bg$fg$SEGMENT_SEPARATOR_LEFT"
zmodload zsh/regex
setopt REMATCH_PCRE
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
parse_node_version() {
(command node -v | sed -e 's/v//g') 2>/dev/null;
}
parse_ruby_version() {