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 / 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
@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 / react-logo-w-bg.svg
Created April 25, 2014 08:16
react.js logo for tshirt
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vslinko
vslinko / rx-react.js
Created May 28, 2015 09:19
tried use rx with react
import React from 'react';
import Rx from 'rx';
import R from 'ramda';
// dispatcher.js
const dispatcher = new Rx.ReplaySubject();
function dispatch(action) {
dispatcher.onNext(action);
}
@vslinko
vslinko / flux-reference.js
Last active August 20, 2016 20:15
minimal flux
/* @flow */
type State = Object
type Action = {type: string | void}
type AsyncAction = (performAction: FluxPerformFunction, state: State) => void
type ActionCreator = () => Action | AsyncAction
type StoreFunction = (state: State, action: Action) => State
function loadingIndicator() {
return Component => {
return class LodingIndicator extends React.Container {
// static displayName =
constructor() {
super();
this.state = {
counters: {},
};
}
@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);
}