Skip to content

Instantly share code, notes, and snippets.

Nikolay Matrosov nikolaymatrosov

Block or report user

Report or block nikolaymatrosov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nikolaymatrosov / index.ts
Last active Jan 9, 2020
Yandex Cloud Cron Snapshot
View index.ts
import {DiskService, SnapshotService} from "yandex-cloud/api/compute/v1";
const FOLDER_ID = process.env.FOLDER_ID;
export async function handler(event, context) {
const snapshotService = new SnapshotService();
const diskService = new DiskService();
const diskList = await diskService.list({
folderId: FOLDER_ID,
View startup.cs
using System;
using System.IO;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
nikolaymatrosov / index.ts
Created Sep 23, 2016
Typescript and Immutable.js Record usage example.
View index.ts
import * as Immutable from 'immutable';
const UserRecord = Immutable.Record({
id: '',
age: 0
}, 'User');
class User extends UserRecord {
public readonly id: string;
public readonly age: number;
nikolaymatrosov / Counter.tsx
Created Jun 9, 2016
Arrow function example
View Counter.tsx
export class Counter extends React.Component<any, any> {
constructor(props) {
this.state = {count: props.initialCount};
tick = () => {
this.setState({count: this.state.count + 1});
render() {
return (
nikolaymatrosov / fixed-data-table.d.ts
Last active Dec 7, 2015
Definiton file to fixed-data-table 0.6.0. Made based on component props types.
View fixed-data-table.d.ts
// Type definitions for fixed-data-table 0.6.0
// Project:
/// <reference path="../react/react.d.ts"/>
declare module FixedDataTable {
export var version: string;
export interface TableProps extends __React.Props<Table> {
nikolaymatrosov / package.json
Created Aug 5, 2015
Mocha test setup for testing React using JsDOM
View package.json
"scripts": {
"test": "mocha --recursive --require test_setup.js src/**/*.spec.js",
"devDependencies": {
"babel": "5.6.14",
"babel-core": "5.6.20",
"babel-plugin-rewire": "0.1.5",
"chai": "3.0.0",
nikolaymatrosov / gist:e78672a17ab45a58b882
Created Jul 7, 2015
Pre-commit hook (check for forgotten `only`, run client tests only on client code changes)
View gist:e78672a17ab45a58b882
SRC=$(git rev-parse --show-toplevel)/src/client
# Check if I forgot to remove 'only' keyword from tests.
# To make sure that before commit run all tests
only=`grep -c -h -r --include "*.spec.js" -E "(describe|it)\.only" $SRC/src | awk -F ':' '{x +=$0}; END {print x}'`
if (( $((only)) > 0 ))
echo 'Remove ONLY from tests.'
nikolaymatrosov / gist:f8bda2f66f848b3eec7d
Created Dec 30, 2014
Lua redirects based on backend response
View gist:f8bda2f66f848b3eec7d
server {
listen 7777;
location / {
root /tmp/www;
index index.html;
try_files $uri @lua;
location /api {
You can’t perform that action at this time.