Skip to content

Instantly share code, notes, and snippets.

View berdyshev's full-sized avatar

Artem Berdyshev berdyshev

  • Self-employed
  • Ukraine, Zaporizhzhia
View GitHub Profile
@berdyshev
berdyshev / react-table.d.ts
Last active July 19, 2022 14:21 — forked from Grsmto/react-table.d.ts
React Table v7 TS typings definition
// Type definitions for react-table 7
// Project: https://github.com/tannerlinsley/react-table#readme
// Definitions by: Grsmto <https://github.com/grsmto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
declare module "react-table" {
export type Cell = {
render: (type: string) => any;
getCellProps: () => any;
column: Column;
@berdyshev
berdyshev / modules-auth.js
Last active June 25, 2018 19:56
Queue of API requests using redux-saga
import { createRequestTypes } from 'utils/actionHelpers';
import { typeValidator } from 'utils/typeValidator';
import { createAction } from 'redux-actions';
import { createApiCall } from 'utils/api';
//region ACTION TYPES
const tokenTypes = {
SIGN_IN: createRequestTypes('SIGN_IN'),
SIGN_OUT: 'SIGN_OUT',
UPDATE_TOKEN: 'UPDATE_TOKEN',
@berdyshev
berdyshev / sample.php
Created June 28, 2013 14:27
Please create a simple function in procedural PHP coding. The function will have to get the words given into an array(feel free to chose the kind), and for each one check if a stop word is found. In case the stop word is found the function will have to replace the characters with asterisks. The stop words are located into the DB in a table named…
<?php
/**
* Filter stop words in the given array of words.
*
* @param array $words Array of words to filter.
* @return array
* New array with filtered words (replaced with asterisks).
*/
function filter_stop_words($words) {
@berdyshev
berdyshev / account.php
Last active November 5, 2018 13:34
Class which handles user's account using PDO.
<?php
/**
* Class Account
*/
class Account {
private $uid;
private $name;
private $surname;
private $email;
<?php
/** Add/Edit Form
*/
function MYMOD_formid_form($form, $form_state){
$form['event'] = array(
'#title' => t('Event'),
'#type' => 'select',
'#empty_option' => '',
'#options' => $event_options, // доступные варианты
'#ajax' => array(
@berdyshev
berdyshev / parse_dta.php
Last active December 10, 2015 23:38
Parse DTA file of fixed format (see spec here http://www.six-interbank-clearing.com/dl_tkicch_dta.pdf). This script parses only transactions 830 and 836 with 5 segments and total amount of transactions (890)
<?php
function parse_header($file) {
$header = array();
$header['requested_precissing_date'] = fread($file, 6);
$header['benef_bank_clearing_no'] = fread($file, 12);
$header['output_sequence_number'] = fread($file, 5);
$header['creation_date'] = fread($file, 6);
$header['order_bank_clearing_no'] = fread($file, 7);
$header['data_file_ident'] = fread($file, 5);
$header['entry_sequence_nubmer'] = fread($file, 5);