Skip to content

Instantly share code, notes, and snippets.

View artello73's full-sized avatar
💥
In the beginning there was nothing, which exploded.

Artem Tambovskiy artello73

💥
In the beginning there was nothing, which exploded.
View GitHub Profile
@artello73
artello73 / checkout.sh
Last active February 15, 2024 07:15
PDO Snowflake patial checkout
git clone --filter=blob:none --no-checkout --depth 1 --sparse https://github.com/snowflakedb/pdo_snowflake.git
cd pdo_snowflake
git sparse-checkout set --no-cone '/*' '!/libsnowflakeclient/*/win64/*' '!/libsnowflakeclient/*/darwin/*'
git sparse-checkout list
git checkout
@artello73
artello73 / account.ts
Created October 9, 2023 17:11 — forked from 3lpsy/account.ts
Svelte Store with Custom Class in Typescript
/*
I recently jumped into svelte programming and wanted to create a class/singleton that could double as a reactive writable store.
I did things very wrong until people on the discord confirmed how wrong my implementation was so I wanted to provide a simple example.
So below is a simple account store you can use. I'm not sure if it's optimal or even correct, but it's better than my first attempt.
Feel free to provide feedback.
*/
```
import { writable } from "svelte/store";
// fake stuff for example
@artello73
artello73 / Git Subtree basics.md
Created September 15, 2023 12:38 — forked from SKempin/Git Subtree basics.md
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@artello73
artello73 / group-objects-by-property.md
Created June 15, 2023 18:45 — forked from JamieMason/group-objects-by-property.md
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@artello73
artello73 / fingerprint.md
Created February 22, 2023 05:34 — forked from zmts/fingerprint.md
Get browser fingerprint example (fingerprintjs2)

Get browser fingerprint example (fingerprintjs2)

import * as Fingerprint2 from 'fingerprintjs2'
import * as UAParser from 'ua-parser-js'

function _getFingerprint () {
  return new Promise((resolve, reject) => {
    async function getHash () {
      const options = {
@artello73
artello73 / private_fork.md
Created February 22, 2023 05:13 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@artello73
artello73 / AzureOAuthB2C.php
Created November 1, 2022 12:00 — forked from rcosgrave/AzureOAuthB2C.php
A quick and dirty implementation of Azure's Active Directory B2C OAuth2 Service using Authorization Code Grant (external libraries required)
<?php
/** This is a simple class to allow for fast implementation of Azure's Active Direct B2C OAuth Service via Authorization Code scope
** It requires the use of the following repos
** https://github.com/firebase/php-jwt
** https://github.com/phpseclib/phpseclib/tree/master/phpseclib (Please note to get this to work I had to move the Math directory inside the Crypt directory)
** Sample Configuration https://login.microsoftonline.com/fabrikamb2c.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=b2c_1_sign_in
** Sample Key Location https://login.microsoftonline.com/fabrikamb2c.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_sign_in
*/
use \Firebase\JWT\JWT;
@artello73
artello73 / azure-ad-connect.php
Created July 6, 2022 09:01 — forked from DragonBe/azure-ad-connect.php
A simple PoC to access Azure AD for authentication
<?php
declare(strict_types=1);
use League\OAuth2\Client\Provider\GenericProvider;
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
const APP_SESS_ID = 'AZPHPSID';
const OAUTH_APP_ID = '';
@artello73
artello73 / tokens.md
Created May 23, 2022 08:01 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@artello73
artello73 / aboutNodeJsArchitecture.md
Created May 23, 2022 07:57 — forked from zmts/aboutNodeJsArchitecture.md
A little bit about Node.js API Architecture

A little bit about Node.js API Architecture (Архитектура/паттерны организации кода Node.js приложений)

node.js

TL;DR

code: https://github.com/zmts/supra-api-nodejs

Предисловие

Одной из болезней Node.js комьюнити это отсутствие каких либо крупных фреймворков, действительно крупных уровня Symphony/Django/RoR/Spring. Что является причиной все ещё достаточно юного возраста данной технологии. И каждый кузнец кует как умеет ну или как в интернетах посоветовали. Собственно это моя попытка выковать некий свой подход к построению Node.js приложений.