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 / .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 / index.html
Last active Nov 20, 2017
AngularJS 1.x Slick Carousel Directive
View index.html
<div class="slick-slider clearfix"
data-slick-carousel
data-slides="gallery.slides"
data-interstitial="gallery.interstitial"
data-settings="{}"
data-active="gallery.active"
data-onchange="gallery.onAfterChange"
data-count="gallery.slides.length"
data-interstitial-link="gallery.interstitial.link"
data-autoplay="true"
@codfish
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
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
codfish / utilities.md
Last active May 2, 2017
List of useful web development related services & tools.
View utilities.md
@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
@codfish
codfish / find_string_in_repo.sh
Created May 24, 2016
Get an alphabetical list of files that a specific string is found within your repo
View find_string_in_repo.sh
git grep '<string to search for>' | awk '{print $1}' | sed 's/:$//' | sort -u
@codfish
codfish / search_multi_array.php
Created May 16, 2016
Search multi-dimensional array based on key value pair. i.e. you have an array of posts, and you want to return the post with the id of `1231`
View search_multi_array.php
<?php
$posts = [
[
'id' => 1231,
'title' => 'Test'
],
[
'id' => 1111,
'title' => 'Test #2'
@codfish
codfish / wedding.sh
Last active Mar 11, 2016
Download wedding photos. Photographer put all of our photos for us and family to buy, but wasn't going to give us a digital copy. So...
View wedding.sh
#!/usr/bin/env bash
# need to set env variable for the public base url for the photos
if [[ -z "$WEDDING_URL_PREFIX" ]]; then
printf '\nError: WEDDING_URL_PREFIX needs to be set in your environment!\n'
exit 1
fi
# image filenames had two different prefixes
IMG_TOTAL=2405
@codfish
codfish / dynamic_iframe_height.js
Last active Sep 16, 2015
Update the height of an iframe dynamically based on the height of the source content. Code is dependent on jQuery, and will only work when iframe is the same host/domain as the parent page, or if you have access to the content of the iframe. Reference: http://goo.gl/Rz3Ryz
View dynamic_iframe_height.js
// @example
// <iframe src="/form.html" id="infographic-iframe"></iframe>
document.getElementById('infographic-iframe').style.height = $('#infographic-iframe').contents().height() + 'px';
You can’t perform that action at this time.