Skip to content

Instantly share code, notes, and snippets.

View pyldin601's full-sized avatar

Román Lakhtadyr pyldin601

View GitHub Profile
@pyldin601
pyldin601 / Dockerfile
Created September 20, 2018 07:46
Multi-stage build of typescript node application example
FROM node:10
ENV NODE_ENV=development
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . ./
RUN npm run build
FROM node:10
ENV NODE_ENV=production
@pyldin601
pyldin601 / index.js
Created September 10, 2018 12:52
FrightenedClassicRegression created by pldin601 - https://repl.it/@pldin601/FrightenedClassicRegression
function fn(name){
return f;
function f(){
var n = name;
console.log("Next TICK "+n+", ");
}
}
function myTimeout(time,msg){
<div *ngIf="(user$ | async) as user; else loading">
<user-profile
[user]="user">
</user-profile>
<user-messages
[user]="user">
</user-messages>
</div>
<ng-template #loading>
@pyldin601
pyldin601 / InvokeListener.ts
Last active June 22, 2018 06:51
Small utility decorator for typescript and rxjs. It wraps method into stream that emits data when original function is called.
import { Subject } from 'rxjs/Subject';
export default function InvokeListener<T>(): MethodDecorator {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const original = descriptor.value;
const emitter$ = new Subject<T>();
const ngOnDestroy = target.ngOnDestroy;
target.ngOnDestroy = function () {
emitter$.complete();
import * as PromiseThrottle from 'promise-throttle';
function makeThrottle(requestsPerSecond: number) {
const promiseThrottle = new PromiseThrottle({ requestsPerSecond });
return (weight: number = 1) => (target: any, key: string, descriptor: PropertyDescriptor) => {
if (descriptor === undefined) {
descriptor = Object.getOwnPropertyDescriptor(target, key);
}
@pyldin601
pyldin601 / ShareLayout.tsx
Created February 23, 2018 17:39
ShareLayout
const ShareLayout: React.StatelessComponent<ComposedShareLayoutInterface> = ({
chain,
setQuantity,
}) => {
return (
<div className="share-chain">
<h1>{chain.title}</h1>
<ChainViewLayout chain={chain.chain} mapParams={makeQuantityEditable(setQuantity)} />
</div>
);
Attribute VB_Name = "ModStdIO"
Option Explicit
Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, _
lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, lpOverlapped As Any) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, _
lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _
lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
defun unique (item i list)
eq?
.indexOf list item
i
def deps-json "
{
\"mongo\": [],
\"tzinfo\": [\"thread_safe\"],
\"uglifier\": [\"execjs\"],
import { fromJS } from 'immutable';
import * as _ from 'lodash';
import {
ACTION_CHAIN_UPDATE,
ACTION_NODE_ADD,
ACTION_NODE_REMOVE,
ACTION_NODE_REMOVE_MULTIPLE,
ACTION_NODE_UPDATE,
ACTION_RUN_ADD, ACTION_RUN_DELETE, ACTION_RUN_UPDATE,
ACTION_UPDATE_ACTIVE_CHAIN,
import * as React from 'react';
interface BlurTextInputStateInterface {
value: string,
lastChangeEvent: React.ChangeEvent<HTMLInputElement>,
}
export default class extends React.Component<React.InputHTMLAttributes<HTMLInputElement>, BlurTextInputStateInterface> {
constructor(props: any) {
super(props);