Skip to content

Instantly share code, notes, and snippets.

View vslinko's full-sized avatar

Viacheslav Slinko vslinko

View GitHub Profile
@vslinko
vslinko / backup_tg.py
Created April 26, 2024 05:45
tg_backup
import telethon
import telethon.tl.types
import os
import json
import glob
api_id = 0
api_hash = ""
limit = 50

/public/v1/get-cities/

{
  "data": [
    {
      "id": 1,
      "slug": "moskva",
      "previewImage": "https://....",
      "name": "Москва"
 }
class JQ {
constructor(jq) {
this._jq = jq
}
sort(newSort) {
return {...this._jq, sort: newSort}
}
paginate(newPage) {
return {...this._jq, page: newPage}
}
@vslinko
vslinko / index.js
Last active February 6, 2018 01:28
const puppeteer = require('puppeteer');
const readline = require('readline-sync');
const util = require('util');
const fs = require('fs');
const USERNAME = 'USERNAME';
const EXPECTED_TEMPLATE_NAME = 'EXPECTED_TEMPLATE_NAME';
const EXPECTED_ACCOUNT_NUMBER = 'EXPECTED_ACCOUNT_NUMBER';
function questionAsync(text, hidden = false) {
@vslinko
vslinko / npm
Last active October 27, 2019 11:52 — forked from rndD/npm
Npm inject для кеширования папки node_modules
#!/usr/bin/env bash
# Фейковый npm
# Нужен для кэширования папки node_modules
# Кэш находится в папке ~/.cache/npm-inject/[sha1 хэш файла package.json]/node_modules
#
# В PATH надо добавить путь папки с фейковым npm, таким образом при выполнении команды `npm install`
# bash вызовет фейковый npm c параметром `install`.
# Фейк проверяет наличие папки [sha1 хэш файла package.json] в кэше.
# Если она в кэше, создаем на неё симлинк node_modules
function loadingIndicator() {
return Component => {
return class LodingIndicator extends React.Container {
// static displayName =
constructor() {
super();
this.state = {
counters: {},
};
}
@vslinko
vslinko / SearchBoxContainer.js
Created December 18, 2015 08:09
Search example
import { compose } from 'redux';
import { connect } from 'react-redux';
import { reduxForm } from 'redux-form';
import { injectIntl } from 'react-intl';
import { createSearchQuery } from '../../actionCreators/search';
import SearchBox from './SearchBox';
export default compose(
@vslinko
vslinko / createQueryExecutor.js
Last active January 5, 2016 17:17
Neo4j Helpers
'use strict';
const CypherQuery = require('./cypher').CypherQuery;
module.exports = function createQueryExecutor(context) {
const executor = function executeQuery(query) {
if (typeof query === 'function') {
return query(executor);
}
@vslinko
vslinko / 01_front_marker.js
Last active December 11, 2015 13:10
React Markers
export default function marker(value) {
if (process.env.NODE_ENV !== 'production') {
return {
'data-marker': value,
};
}
return {};
}
@vslinko
vslinko / 01_readme.md
Last active August 29, 2015 14:25
Experimental Relay Implementation

Experimental Relay Implementation

Features:

  • Relay.fetch(graphqlQuery) returns subscribtion that could change over time by mutation queries.
  • Relay.update(m: UpdateMutation) optimistically updates resource in all previous queries that contains updated resource.
  • Relay.update(m: DeleteMutation) optimistically deletes resource from all previous queries that contains deleted resource.
  • Relay.update(m: CreateMutation) pessimistically creates resource and executes again all previous queries.
  • All objects with id key in graphql response explained as resources. Arrays, objects without id and scalars explained as static properties.