Skip to content

Instantly share code, notes, and snippets.

Chris O'Donnell codfish

Block or report user

Report or block codfish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@codfish
codfish / bash_notebook.md
Last active Aug 7, 2019
Helpful bash commands & reference. Some commands specific to Debian-based distros.
View bash_notebook.md

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 / .php_cs.dist
Last active Aug 5, 2019
PHP-CS-Fixer configuration file. PSR-2 plus some opinionated options to make code cleaner.
View .php_cs.dist
<?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 Jul 24, 2019
Prettier + ESLint + airbnb config + Husky + lint-staged + commitlint + markdownlint
View #linting.md

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. Ultimate goal is maximize code linting coverage, leveraging the power of Prettier while deferring to Airbnb's style guide AS MUCH as possible without breaking anything. 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.

Installation

npm install --save-dev --save-exact prettier
npm install --save-dev husky lint-staged @commitlint/cli @commitlint/config-conventional markdownlint-cli
npx install-peerdeps --dev eslint-config-codfish
@codfish
codfish / Dockerfile
Last active Feb 20, 2019
Example json-server module for marketing campaigns. `json-server api.js`
View Dockerfile
FROM mhart/alpine-node:11.10
RUN mkdir /app
WORKDIR /app
COPY ./package.json ./package-lock.json ./
RUN npm install
EXPOSE 4000
CMD npm run dev
@codfish
codfish / now-headers.json
Last active Jan 16, 2019
Cache control headers for static assets with Now. http://codfi.sh/Ukim4l
View now-headers.json
{
"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"
@codfish
codfish / Ethereum event fixtures for js.md
Last active Jan 15, 2019
Ethereum event fixtures for js.
View Ethereum event fixtures for js.md

To install a relatively recent version of Faker you'll need to install from a commit. The maintainer is still active and merging new features, but does not cut new releases.

npm install --save-dev faker@Marak/faker.js#<commit-sha>

I.e. npm install --save-dev faker@Marak/faker.js#d3ce6f1 (latest commit at the time of writing).

@codfish
codfish / git-reference.md
Last active Jan 10, 2019
GIT Cheat Sheet & Reference
View git-reference.md

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 / error-handling.js
Last active Jan 4, 2019
Default express api error handling middleware.
View error-handling.js
/**
* Handle application errors.
*
* NOTE: 500 status code is returned by default.
*
* To properly leverage this middleware, rather than return responses in your routes,
* simply set a response status in the route and then pass the error object to `next`.
* This middleware will catch that error and handle it in a consistent way across
* the entire application. For example:
*
@codfish
codfish / docblocks-spec.md
Last active Dec 20, 2018
Documenting your code
View docblocks-spec.md

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 / reference.md
Last active Dec 2, 2018
Dev Resources & Reference
View reference.md

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.

  • Cheat Sheets -- Source
  • HEAD: A list of everything that could go in the head of your document -- Source
  • Shields.io: We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and many more services. Use them to track the state of your projects, or for promotional purposes. -- Source
  • Storybook: The UI Development Environment. -- Source
  • Branching & Release Strategy -- Source
  • Probot: GitHub Apps to automate and improve your workflow. Use pre-built apps to extend GitHub, and easily build and share your own. -- [Source](https://probot.gith
You can’t perform that action at this time.