Skip to content

Instantly share code, notes, and snippets.

@goloveychuk
goloveychuk / redux-hooks.tsx
Last active November 19, 2018 18:51
redux-hooks.tsx
import React, {
Component,
useContext,
useMemo,
useState,
useEffect
} from "react";
import { ReactReduxContext, Provider } from "react-redux";
import { Selector } from "reselect";
import {
import * as ts from 'typescript';
function loadWithLocalCache<T>(
names: string[],
containingFile: string,
loader: (name: string, containingFile: string) => T,
): T[] {
if (names.length === 0) {
return [];
import * as ts from "typescript";
const path = require("path");
function rstrip(str: string, strip: string) {
let ind = str.lastIndexOf(strip);
if (ind === str.length - strip.length) {
return str.slice(0, str.length - strip.length);
}
return str;
}
@goloveychuk
goloveychuk / code.ll
Last active August 31, 2018 02:32
swift to wasm
; ModuleID = 'code.ll'
source_filename = "code.ll"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32"
%swift.type = type { i64 }
%swift.type_metadata_record = type { i32, i32 }
%T4code5StrctV = type <{ %TSi, %TSi }>
%TSi = type <{ i64 }>
@goloveychuk
goloveychuk / asd.swift
Created January 13, 2018 21:19
fix batterfly
import QuartzCore
let BLACK_LISTED: [Int64] = [8, 36]
var TIMEOUT = 100
struct State {
var lastTimestamp: CGEventTimestamp? = nil
[at-loader]: Child process failed to process the request: TypeError: Cannot read property 'exports' of undefined
at resolveName (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:26110:70)
at resolveEntityName (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:26686:26)
at Object.getTypeReferenceSerializationKind (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:45669:31)
at serializeTypeReferenceNode (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:50023:30)
at serializeTypeNode (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:49967:28)
at serializeUnionOrIntersectionType (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:49989:44)
at serializeTypeNode (/Users/badim/github/orzo/orzo-frontend/node_modules/typescript/lib/typescript.js:49970:28)
at serializeReturnTypeOfNode (/Users/badim/git
import ZeroMQ
import Venice
import Foundation
import C7
let context = try! Context()
struct Error: ErrorProtocol {
<script>
var clsName = "selected"
var list = document.getElementsByTagName("p")
for (var i in list) {
var el = list[i]
el.addEventListener("click", function () {
class Users: Views.Endpoint/View/Resource, Views.List, Views.Create, Views.Delete, Views.Update//for all just Views.Generic {
let model: Users
var queryset: QuerySet {//it should support paginate, filter, remove and other simple queries. Maybe this should be `d5` protocols
return Users.all
}
let filters: [User.id.eq, User.name.eq, User.created.range]
let authentication: [TokenAuthentication]
let serializerClass: UserSerializer
import ZeroMQ
import Venice
import Foundation
import C7
let context = try! Context()
struct Error: ErrorProtocol {