Skip to content

Instantly share code, notes, and snippets.

View gtkatakura's full-sized avatar

gtkatakura

View GitHub Profile
// library or otherwise
// {
type Func<T, TResult> = (value: T) => TResult;
type Predicate<T> = Func<T, boolean>;
function compose<TIn, TMiddle, TOut>(f: Func<TMiddle, TOut>, g: Func<TIn, TMiddle>) {
return (value: TIn) => f(g(value));
}
@gtkatakura
gtkatakura / bubble-grid-2017.css
Created November 15, 2017 04:26 — forked from OviOvocny/bubble-grid-2017.css
Modern impractical stylesheet for old-style AniList lists.
{ANILIST-COVERS=LRG}
{ANILIST-POPUP}
body {
background-color: hsl(217, 23%, 16%);
}
/**/
{ANILIST-COVERS=LRG}
{ANILIST-POPUP}
body {
background: #222;
}
.list_wrapper {
margin-left: 0;
max-width: 100%;
@gtkatakura
gtkatakura / CardLitev45.css
Created November 15, 2017 04:26 — forked from OviOvocny/CardLitev45.css
Superovoce is at it again!
/* ANILIST MODIFIERS */
{ANILIST-COVERS=LRG}
/* ACTUAL CASCADING STYLE SHEETS -- Explore it all to find DISABLED FEATURES you might want enabled (or not, what do I know) */
@import "http://fonts.googleapis.com/css?family=Maven+Pro"; /* Custom font, feel free to delete if you don't want it */
body {
background-color: #333;
#container-main {perspective: 1px; height: 100vh; margin-left: -100px; padding-left: 150px; overflow-x: hidden; overflow-y: auto;}
#container-main::before {
content: "";
display: block;
width: 100%;
margin-left: -100px;
position: absolute;
background: url(http://40.media.tumblr.com/fbba87d327660462c8e834e164c526ca/tumblr_mzdgx16SIq1qfu9ibo3_540.jpg) top;
@gtkatakura
gtkatakura / toResponseBy.js
Created March 16, 2018 03:06 — forked from gtkatakura-bysoft/toResponseBy.js
lodash/fp + mapValues + toResponseBy = toMovie
import _ from 'lodash/fp'
const response = {
"Title": "Pulp Fiction",
"Year": "1994",
"Rated": "R",
"Released": "14 Oct 1994",
"Runtime": "154 min",
"Genre": "Crime, Drama",
"Director": "Quentin Tarantino",
var GTK = func => (...args) => {
let result;
const self = (...args) => result(...args);
result = func(self)(...args);
return result;
}
var applyMiddlewares = GTK(enhancedDispatch => (middlewares, dispatch, getState) => {
@gtkatakura
gtkatakura / curry-typescript.ts
Created May 6, 2018 18:13
TypeScript + Curry
type ThemeColor = string;
type Theme = { id: number, color: ThemeColor }
type State = { themes?: [Theme] }
interface CurriedFunction1<T1, R> {
(t1: T1): R;
}
interface CurriedFunction2<T1, T2, R> {
(t1: T1): CurriedFunction1<T2, R>;
@gtkatakura
gtkatakura / reducers.ts
Last active May 7, 2018 00:51
TypeScript + Reducers
type ThemeColor = string;
type Theme = { id: number, color: ThemeColor }
type State = { themes?: [Theme] }
type ExtractFirstArgument<T> =
T extends (T1: infer T1) => infer R
? (T extends (t1: infer T1, t2: infer T2, t3: infer T3) => infer R
? Extract<T2, undefined> extends never
? () => R
: (Extract<T3, undefined> extends never
const defaultMiddleware = next => (...args) => next(...args)
const compose = (() => {
const base = (f, g) => (...args) => f(g(...args));
return (...funcs) => funcs.reduce(base)
})();
const applyMiddlewares = (middlewares, func) => compose(...middlewares)(func);
const recursive = (func, middlewares = [defaultMiddleware]) => {