Skip to content

Instantly share code, notes, and snippets.


Chris O'Donnell codfish

View GitHub Profile
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
COPY ./package.json ./package-lock.json ./
RUN npm install
CMD npm run dev
codfish / swagger.yml
Created Apr 3, 2018
Example swagger 2.0 doc with extensive use of reusable definitions, responses & parameters.
View swagger.yml
swagger: '2.0'
version: '0.0.1'
title: Marketing Campaign API
basePath: /v1
codfish / htmlentity.js
Created Feb 28, 2018 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
View htmlentity.js
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {

Xdebug tends to slow down a lot of things. Here's a hack to unload the extension by default but load it whenever it's needed (for instance, when generating php code coverage.

Prevent Xdebug from loading by default

If you use brew to install php 7, should be here: /usr/local/etc/php/<version>/conf.d/ext-xdebug.ini. Edit that file (replacing <version> with whatever version of php you're using) and comment out the line that begins with zend_extension. The code examples here assume 7.0.

codfish / .php_cs.dist
Last active Apr 5, 2020
PHP-CS-Fixer configuration file. PSR-2 plus some opinionated options to make code cleaner.
View .php_cs.dist
* Rules we follow are from PSR-2 as well as the rectified PSR-2 guide.
* -
* -
* -
* If something isn't addressed in either of those, some other common community rules are
codfish / index.html
Last active Nov 20, 2017
AngularJS 1.x Slick Carousel Directive
View index.html
<div class="slick-slider clearfix"
codfish / app-controller.js
Created Nov 20, 2017
AngularJS 1.X Meta Service
View app-controller.js
* Application Controller
* @ngInject
function AppCtrl($rootScope, $log, $state, MetaService, configuration) {
$rootScope.$on('$stateChangeSuccess', function(event, state, params, from, fromParams) {
// set canonical based on the new state url & param values
MetaService.canonical = configuration.DOMAIN_HOST + $state.href(state, params);
codfish / no-js-no-styles.scss
Last active Sep 21, 2017
Remove site styles when js is not supported
View no-js-no-styles.scss
// when using modernizr or similar
.no-js body * {
display: initial !important;
opacity: 1 !important;
visibility: visible !important;
overflow: visible !important;
transform: none !important;
float: none !important;
position: static !important;
height: auto !important;
codfish /
Last active Oct 18, 2020
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
  • Cloudinary: Store, transform, optimize, and deliver all your media assets with easy-to-use APIs, widgets, or user interface. -- Source
  • Spectacle: A React.js based library for creating sleek presentations using JSX syntax that gives you the ability to live demo your code. -- Source
  • Cheat Sheets -- Source
  • HEAD: A list of everything that could go in the head of your document -- Source
  • We serve fast and scalable informational images as badges for GitHub, Travis CI, Jenkins, WordPress and man
codfish /
Created May 24, 2016
Get an alphabetical list of files that a specific string is found within your repo
git grep '<string to search for>' | awk '{print $1}' | sed 's/:$//' | sort -u
You can’t perform that action at this time.