Skip to content

Instantly share code, notes, and snippets.

View LukaGiorgadze's full-sized avatar
🏠
Working from home

Luka Giorgadze LukaGiorgadze

🏠
Working from home
View GitHub Profile
@LukaGiorgadze
LukaGiorgadze / AST package example.go
Last active February 27, 2023 18:44
Example demonstration of ast package that retrieves all structs from .go file. (Stackoverflow answer)
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"log"
)
@LukaGiorgadze
LukaGiorgadze / EllipticCurve.go
Last active March 18, 2024 08:02
Golang ECDSA (Elliptic Curve Digital Signature Algorithm) example, generate Private/Public key pairs, verify and test
package ec
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/md5"
"crypto/rand"
"crypto/x509"
"encoding/pem"
"errors"
@LukaGiorgadze
LukaGiorgadze / ReactWindowResizeHandlerHook.js
Last active October 3, 2019 10:05
This hook allows you to detect window size and resize.
// @flow
import { useState, useLayoutEffect } from 'react';
/**
* This hook allows you to detect window size
* @param handler Function
* @return Object window size (number width, number height)
* */
export function useWindowSize(handler: Function): { width: number, height: number } {
const isClient = typeof window === 'object';
@LukaGiorgadze
LukaGiorgadze / ReactGestureHandlerHook.js
Last active October 1, 2019 08:10
This react hook allows you to detect dragging and swiping of an element,
// @flow
import { useState, useLayoutEffect } from 'react';
import type { ElementRef } from 'react';
/**
* This react hook allows you to detect dragging and swiping
* @param ref HTML Element ref (react ref)
* @param handler Function Callback
* @param config Object
* @return Function remove listeners