Skip to content

Instantly share code, notes, and snippets.

View martink-rsa's full-sized avatar

Martin Kruger martink-rsa

View GitHub Profile
@martink-rsa
martink-rsa / AI_PAYFAST_BASE.md
Last active October 4, 2025 04:16
UNOFFICAL Payfast raw markdown documentation

UNOFFICIAL Payfast Developer Documentation

PayFast documentation in markdown format so it's easier to develop locally.

Documentation

Quickly integrate PayFast into your platform.


@martink-rsa
martink-rsa / JSDocs-7-react-hook.jsx
Created October 3, 2022 21:43
JSDocs: Documenting a React hook
import { useState } from 'react';
/**
* @typedef {Object} UseGreetingReturns
* @property {Function} setNewName Sets a new name
* @property {Function} getGreeting Returns a greeting message
*/
/**
* Hook that is used for greeting a user
@martink-rsa
martink-rsa / JSDocs-6-react-component.jsx
Last active October 3, 2022 21:41
JSDocs: Documenting a React component
/**
* @typedef {Object} Props
* @property {string} name Name of the user e.g. Lily
*/
/**
* Displays a greeting to the user.
* @param {Props} props
* @example
* <Greeting name="Lily" />
@martink-rsa
martink-rsa / JSDocs-5-typedef.js
Created October 3, 2022 19:38
JSDocs: Creating custom types with @typedef
const person = {
firstName: 'Michael',
lastName: 'Scott',
};
/**
* @typedef {Object} Person
* @property {string} firstName The person's first name
* @property {string} lastName The person's last name
*/
@martink-rsa
martink-rsa / JSDocs-4-deprecated.js
Created October 2, 2022 20:23
JSDocs: Deprecating old code
/**
* @deprecated since version 1.0.0
*/
function addNumbers(value1, value2) {
return value1 + value2;
}
/**
* Adds two numbers together and returns the result.
* @param {number} value1 - The first value
* @param {number} value2 - The second value
* @returns {string} The values that have been added together
* @example
* const a = 10;
* const b = 20;
*
* const result = addNumbers(a, b);
@martink-rsa
martink-rsa / JSDocs-2-return.js
Last active October 3, 2022 19:37
JSDocs: Documenting the return with @returns
/**
* Adds two numbers together and returns the result.
* @param {number} value1 - The first value
* @param {number} value2 - The second value
* @returns {string} The values that have been added together
*/
function addNumbers(value1, value2) {
return value1 + value2;
}
@martink-rsa
martink-rsa / JSDocs-1-param.js
Created October 2, 2022 18:24
JSDocs: Documenting parameters with @param
/**
* Adds two numbers together and returns the result.
* @param {number} value1 The first value
* @param {number} value2 The second value
*/
function addNumbers(value1, value2) {
return value1 + value2;
}
@martink-rsa
martink-rsa / JSDocs-0-How-They-Work.js
Created October 2, 2022 17:15
JSDocs: How they work
/**
* Adds two values together and returns the result.
*/
function addNumbers(value1, value2) {
return value1 + value2;
}