Skip to content

Instantly share code, notes, and snippets.

View konsalex's full-sized avatar
👨‍🔬
Building Graph-ical Interfaces

Costa Alexoglou konsalex

👨‍🔬
Building Graph-ical Interfaces
View GitHub Profile
@konsalex
konsalex / hopp-cla.md
Created July 30, 2025 07:04
Hopp CLA

INDIVIDUAL CONTRIBUTOR LICENSE AGREEMENT Thank you for your interest in contributing to the open source projects of Hopp, a pair programming app. Hopp is jointly owned by Konstantinos Alexoglou ([email protected]) and Iason Paraskevopoulos ([email protected]). In order to clarify the intellectual property license granted with Contributions from any person or entity, Hopp must have a Contributor License Agreement ("Agreement") on file that has been signed by each Contributor, indicating agreement to the license terms below. This Agreement is for your protection as a Contributor as well as the protection of Hopp; it does not change your rights to use your own Contributions for any other purpose.

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Hopp. Except for the licenses granted herein to Hopp and recipients of software distributed by Hopp, You reserve all right, title, and interest in and to Your Contributions.

Definitions "You" (or "Your") s

@konsalex
konsalex / commit-message.sh
Last active June 20, 2024 02:40
Generate a commit message based on a changeset file 🦋 using ollama 🦙
#!/bin/bash
file=$(find ./.changeset/ -type f -name '*.md' | grep -E '^[./a-z-]+\.md$')
prompt_template=$(cat <<-END
You are a programmer, trained to write commit messages.
You follow the Conventional Commits specification.
feat: for new features
chore: for maintenance work
fix: for bug fixes
@konsalex
konsalex / .main.js
Created June 25, 2023 16:44
Storybook v7 Vite builder template setup
import { mergeConfig } from 'vite';
import path from 'path';
export default {
framework: '@storybook/react-vite',
features: {
storyStoreV7: true,
},
stories: [
'../stories/**/*.stories.mdx',
@konsalex
konsalex / barrelPlugin.ts
Created April 26, 2023 18:02
Replace barrel imports
import acorn, { SourceLocation } from 'acorn';
import { ancestor } from 'acorn-walk';
type ImportType = 'local' | 'package';
function generateIndividualImport(iconName: string, type: ImportType) {
/**
* Icon name can be:
* - CheckCircleIconSolid - hero icon
* - CheckCircleIconOutline - hero icon
@konsalex
konsalex / slackFavicon.js
Created April 29, 2022 09:12
Slack Notification Favicon removal 😌
// The default "no notifications" icon of Slack on web
const simpleFavicon =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAFyklEQVR4nO2bPXMTVxiFz3tlyySFspqBTCiAVefGQi7CDAFnrBYmweoIjfUPLHcUEEuBIl3kX4BVBNNJDhmczkqRDzCFMBR0XgwzyWTMeCEzmcH27kkhY4y1kvZaV/5I/My4uffq7LtntOu7Z18JDJOaW7H7+tQYyWEAFgUOfc6sr6FSS8edMBr9s1ftKKKj8P0RiFgEHAFmVt+sVZ5mvg2lERYxKXbml1cTAPNNph0RTt7/LF5spZH86esx+Gy2xgVQWLhwo6WGDsYMaHPy71Aq++BsrBQ0lZy9NgFKew1g3JQJRgxIza3Y0agshlzurq4yUUvH3a2D/bNX7Sh7Q2uoN38napmi23ZlG1SnAgDQF1UTGsutvl5ktw/2oldLw4/Gchrrm2LEAJIprfWC4e1j4ouWBpTeMZvKmBCBIKWznCIfNWponhBxWmt9E8wYADiGdHYdIwYIUDOhsxcYMcDzOWlCZy8wYsDDoXiVB9QEU/cAzA/FcwfRBGMGABsmgIMgSyBqqN8cG/6kvqXdF/SYFpw/F68BjRud/YrRb8BB5NCAvS5gr3nvHpCaW7GjR9QoyBSot71tgkuBC7K0topq2EDEBHY5Z8WOxMZIpoS0KeIGhSqbj8Of/vpqTNg0iDCBA4/jDz6PV4Imk/euU1dv4cKNRKBWPVTJA7ACpl1sCVUUUA8zunzyAGAjIuUzv70e7eZBkrPXJjYSJavJEgvAd8l713MAoFJzK3aoJMcUvl9Mza1Y3ZDun71qh0yUAGAiVc5ZSjPMMEFgIGKCnYQqygdHulFMK4ICERPsJFRR0vxa6RqBgYi+itswJLT0JHBacf/syx2dxYS4nR6QgKMUdz/MUD5nAsr5WUdDyE
@konsalex
konsalex / simple-pagination.ts
Last active October 23, 2021 20:11
Simple pagination algorithm in Typescript
/**
* Original version from: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
* just typed and ready to paste 🎉
*/
const pagination = (c: number, m: number) => {
const current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
@konsalex
konsalex / deepEqualityNoProto.ts
Last active May 28, 2021 08:42
Deep Equality without `__proto__`
/**
* Deep equality of Array of Objects
*
* Omits the __proto__ from the deep equality check also
* The assumption here is that the Array is ordered in every check.
*
* An alternative would be JSON.stringify and then check which is slow in
* large array of objects
*
*/
@konsalex
konsalex / Functional-Component.code-snippets
Last active February 21, 2021 15:53
Create React Functional Component (VScode snippet)
{
"Functional Default Component": {
"scope": "javascript,typescript,typescriptreact, javascriptreact",
"prefix": "rdc",
"body": [
"export default function ${TM_FILENAME_BASE}() {",
" return (<>Template</>);",
"}"
],
"description": "Creates React functional component with default export"
@konsalex
konsalex / fullPageScreenshot.js
Created January 14, 2020 11:38
Puppeteer Full page Screenshot Workaround
function addStyleString(str) {
var node = document.createElement("style");
node.innerHTML = str;
document.body.appendChild(node);
}
const viewportWidth = window.innerWidth;
const viewportHeight = window.innerHeight;
const new_vh = 0.01 * viewportHeight;
const new_vw = 0.01 * viewportWidth;
function addStyleString(str) {
var node = document.createElement("style");
node.innerHTML = str;
document.body.appendChild(node);
}
const viewportWidth = window.innerWidth;
const viewportHeight = window.innerHeight;
const new_vh = 0.01 * viewportHeight;
const new_vw = 0.01 * viewportWidth;