Skip to content

Instantly share code, notes, and snippets.

View xandrkat's full-sized avatar
🎯
Your life in your mind.

Alexandr Katrazhenko xandrkat

🎯
Your life in your mind.
View GitHub Profile
@xandrkat
xandrkat / post-checkout
Last active July 12, 2023 12:24
git checkout/clone hook
#!/usr/bin/env sh
COMPOSER_JSON=$(pwd)/composer.json
PACKAGE_JSON=$(pwd)/package.json
if [ -f "$COMPOSER_JSON" ]; then
composer -v > /dev/null 2>&1
COMPOSER=$?
if [[ $COMPOSER -ne 0 ]]; then
echo 'Composer is not installed'

Keybase proof

I hereby claim:

  • I am xandrkat on github.
  • I am xandrkat (https://keybase.io/xandrkat) on keybase.
  • I have a public key ASDi-zrScGTN6CKxP2J1Fa_slVtyMmC-14Nqjr1khhcezQo

To claim this, I am signing this object:

@xandrkat
xandrkat / .js
Created August 20, 2022 17:50
dict
const _ = '_',
bs = '[',
be = ']',
сbs = '{',
сbe = '}',
eq = '=',
sp = ' ',
d = '-',
dot = 'dot',
h = 'h',
pragma solidity ^0.4.23;
contract Consts {
string constant TOKEN_NAME = "AmonD";
string constant TOKEN_SYMBOL = "AMON";
uint8 constant TOKEN_DECIMALS = 18;
uint256 constant TOKEN_AMOUNT = 7600000000;
}
did:3:bafyreih2m76ekwh26cg3ctedlxlfxsikg4nnl7524f3d2mboanbvkbijru
@xandrkat
xandrkat / yii2-dynamicModel-tip.php
Last active December 13, 2021 22:18
Yii2 DynamicModel tip - Reuse, modify & configure as you need!
<?php
/*------------------Controller|Model|Behavior|/|\ANY/|\----------------------*/
$attributes = ['att_'.(n+1),];
$attribute = new (new class extends DynamicModel {/*Reuse, modify & configure as you need!*/})(...$attributes);
/*----------------------------------------------------------------------------*/
/*------------------------------View------------------------------------------*/
$form = ActiveForm::begin();
echo $form->field($attribute, $attributes['att_'.(n+1)])->(any:text,file, list)Input();
ActiveForm::end();
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@xandrkat
xandrkat / functions.php
Last active March 11, 2021 13:18
FileName Helper Function
<?php
$file = '/any/file/path/filename.extension';
substr($file, strrpos($file, '/') + 1); // return 'filename.extension' from $file
?>
var map = [];
var last = 0;
for (var i = 1; i <= 5; i++) {
if ($('body').find('h' + i).length > 1) {
map[i] = $('body').find('h' + i);
map[i]['i'] = i;
}
}
did:3:bafyreif2ukasit36oth6yrgrbmjylcpvrka5rc6atzd4yjfjvudjmana6y