Skip to content

Instantly share code, notes, and snippets.

@domwebber
domwebber / Container-clsx.tsx
Last active February 15, 2023 10:21
TypeScript React "as" Typing
// clsx variant of the base Container component
import React, { ReactNode, ElementType, ComponentPropsWithoutRef } from "react";
import clsx, { ClassValue } from "clsx";
export interface ContainerProps<Tag extends ElementType> {
children: ReactNode;
className?: ClassValue;
as?: Tag;
}
@marcoandre1
marcoandre1 / SSH-configuration-github-gitlab.md
Last active June 10, 2024 04:03
Managing SSH keys for Github and Gitlab

Managing SSH keys for Github and Gitlab

NOTICE: This guide will help you set ssh keys for GitHub and GitLab. However, this is not going to change your commit user.name or user.email. If you need to change those for specific repositories, just run the following commands while in your repository:

git config user.name "Your Name Here"
git config user.email your@email.com

For more info, see this answer. Also, keep in mind this only changes the .git folder inside your repository which never gets added/committed/pushed/uploaded.

I recently had to manage two ssh keys (one for Github and one for Gitlab). I did some research to find the best solution. I am justing putting the pieces together here.

@iskenxan
iskenxan / useConfirmationDialog.js
Last active September 19, 2021 14:33
useConfirmationDialog hook and implementation
import React, { useCallback, useState } from 'react';
import ConfirmationDialog from 'components/global/ConfirmationDialog';
export default function useConfirmationDialog({
headerText,
bodyText,
confirmationButtonText,
onConfirmClick,
}) {
const [isOpen, setIsOpen] = useState(false);
@domwebber
domwebber / BinaryTree.php
Last active April 28, 2022 11:20
PHP Business Logic Lexer
<?php
namespace Salesportal\Query\AST;
class BinaryTree extends Node {
protected $left;
protected $right;
public function getLeft(){
return $this->left;
@domwebber
domwebber / linear_regression.class.php
Last active October 18, 2022 02:23
Linear Regression calculation class in PHP
<?php
class linear_regression {
public function __construct( array $dataset ){
$this->dataset = $dataset;
//Start the execution timer
$start = microtime( true );
//Make the calculations
@RafPe
RafPe / main.go
Created August 29, 2019 09:17
SQS Polling with golang channels
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"fmt"
)
@sethvargo
sethvargo / create-certs.sh
Created June 6, 2018 16:20
Use openssl to create an x509 self-signed certificate authority (CA), certificate signing request (CSR), and resulting private key with IP SAN and DNS SAN
# Define where to store the generated certs and metadata.
DIR="$(pwd)/tls"
# Optional: Ensure the target directory exists and is empty.
rm -rf "${DIR}"
mkdir -p "${DIR}"
# Create the openssl configuration file. This is used for both generating
# the certificate as well as for specifying the extensions. It aims in favor
# of automation, so the DN is encoding and not prompted.
@meain
meain / loading_messages.js
Last active June 20, 2024 08:05
Funny loading messages
export default [
"Reticulating splines...",
"Generating witty dialog...",
"Swapping time and space...",
"Spinning violently around the y-axis...",
"Tokenizing real life...",
"Bending the spoon...",
"Filtering morale...",
"Don't think of purple hippos...",
"We need a new fuse...",
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active June 12, 2024 14:34
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active June 25, 2024 09:41
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub