Skip to content

Instantly share code, notes, and snippets.

View codfish's full-sized avatar

Chris O'Donnell codfish

View GitHub Profile
@codfish
codfish / reference.md
Last active April 11, 2024 19:18
Dev Resources & Reference

Here are some sites with useful developer tools & reference material. Some of them are simple links to the original source, while some are also elaborated on below for quick & helpful reference.

  • Fauna: The database built for serverless, featuring native GraphQL -- Source
  • Upstash: Another database service built for serverless, specifically focused on Redis, but also featuring GraphQL -- Source
  • Cloudinary: Store, transform, optimize, and deliver all your media assets with easy-to-use APIs, widgets, or user interface. -- Source
  • Mailtrap.io: Safe Email Testing for Staging & Development. -- Source
  • k6: Open source load testing tool and SaaS for engineering teams. -- Source
  • Algolia: Rapidly create and scale AI-powered search and discovery across websites and applications. Algolia is fast, customizable and secure. -- Source
  • **S
@codfish
codfish / docblocks-spec.md
Last active November 14, 2023 16:46
Documenting your code

Documenting Your Code

This is a detailed spec on how developers should be documenting their code. While inline code comments are very important, this specification will be focusing on docblock structure.

Docblocks are required for all class methods & properties/attributes. The reason we have this spec, and the reason that actual language standards exist for docblocks, is so that generators will know how to parse your code & render consumable html documentation.

For this reason, documentation standards follow the existing spec's that are currently community standards at the time of writing, and we should be following them.

@codfish
codfish / git-reference.md
Last active August 3, 2023 15:22
GIT Cheat Sheet & Reference

GIT Cheat Sheet & Reference

Here's some helpful git examples and reference for everyday issues.

# set new remote url
git remote set-url origin <remote_git_url>

# Update the latest commit
git commit --amend
@codfish
codfish / .php_cs.dist
Last active July 6, 2023 19:12
PHP-CS-Fixer configuration file. PSR-2 plus some opinionated options to make code cleaner.
<?php
/**
* Rules we follow are from PSR-2 as well as the rectified PSR-2 guide.
*
* - https://github.com/FriendsOfPHP/PHP-CS-Fixer
* - https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
* - https://github.com/php-fig-rectified/fig-rectified-standards/blob/master/PSR-2-R-coding-style-guide-additions.md
*
* If something isn't addressed in either of those, some other common community rules are
@codfish
codfish / #linting.md
Last active July 5, 2023 12:29
Prettier + ESLint + airbnb + Husky + lint-staged + commitlint

My personal & professional linting setup. Extends airbnb's ESLint config first, then Prettier. Run's Prettier as an ESLint rule via their ESLint plugin. Dynamic support for react or non-react applications depending on your project dependencies. Dynamic inclusion of Kent C Dodds' ESLint Jest config depending on your project dependencies.

Convenient opt-in configs for projects using Docker or Ethereum to avoid common false positives.

To understand more, see https://github.com/codfish/eslint-config-codfish.

To avoid having to manually setup everything and add all configuration/boilerplate code to your project, use cod-scripts instead. It was forked from kcd-scripts and ultimately inspired by react-scripts.

Why

@codfish
codfish / new_mac.sh
Last active June 25, 2022 13:53
Setup new Mac
xcode-select --install
ssh-keygen
cat ~/.ssh/id_rsa.pub | pbcopy
# -> add ssh key to github
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/codfish/dotfiles/main/install.sh) --with-apps"
# -> open dropbox and log in
sh ~/Dropbox/configfiles/bin/setup
@codfish
codfish / bash_notebook.md
Last active June 25, 2022 13:34
Helpful bash commands & reference. Some commands specific to Debian-based distros.

Bash Notebook

Popular

  • mkdir -p /path/to/dir/to/create - Recursively create directories if necessary
  • scp -r <host>:</source/path> <host>:</destination/path> - Recursively copy files & directories over ssh
  • printenv - List all environment variables
  • lsof -i :<port> - Find out which process is listening upon a port

Conditional Logic

@codfish
codfish / handlebars-helpers.js
Last active April 13, 2022 10:29
Some useful helpers for the handlebars js templating library.
/**
* Useful helpers for the handlebars js templating library
*
* @uses Handlebars
* @link https://gist.github.com/elidupuis/1468937 <Some credit due>
*/
;(function(Handlebars, window, document, undefined) {
'use strict';
/**
@codfish
codfish / Module.jsx
Last active April 30, 2021 21:17
React Module component with context
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import styles from './Module.style';
import { Provider } from '../context/module';
const Module = ({ expandable, closed, children, className: classNameProp, ...other }) => {
const className = clsx(styles.root, classNameProp);
return (
@codfish
codfish / now-headers.json
Last active November 13, 2020 16:19
Cache control headers for static assets with Now. http://r.codfi.sh/Ukim4l
{
"version": 2,
"name": "codfish.io",
"alias": "codfish.io",
"builds": [{ "src": "package.json", "use": "@now/static-build" }],
"routes": [
{
"src": ".*\\.(js|css|jpg|jpeg|gif|png|svg|txt|ttf|woff2|webmanifest)$",
"headers": {
"Cache-Control": "public, max-age=157680000, s-maxage=157680000"