Skip to content

Instantly share code, notes, and snippets.

View chrisquinnr's full-sized avatar

Chris Quinn chrisquinnr

View GitHub Profile
@chrisquinnr
chrisquinnr / gist:deb3e9d2feaec7bb5b8f
Last active August 29, 2015 14:06
No more "Howdy" in WordPress
function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) {
$current_user = wp_get_current_user();
$profile_url = get_edit_profile_url( $current_user->ID );
if ( 0 != $user_id ) {
// Add the "My Account" menu
$avatar = get_avatar( $user_id, 28 );
$howdy = sprintf( __('Welcome, %1$s'), $current_user->display_name );
$class = empty( $avatar ) ? '' : 'with-avatar';
@chrisquinnr
chrisquinnr / gist:15ab4a7b6489857e82d7
Created March 19, 2015 09:46
WordPress - bind a category editing page to a parent page of your choosing
/**
* This rather nifty snippet forces the category edit screen to be bound to a defined parent
*/
function fixUserTaxPage( $parent_file = '' ) {
global $pagenow;
$taxes = array('taxonomy1', 'taxonomy2', 'taxonomy3');
if ( ! empty( $_GET[ 'taxonomy' ] ) && in_array($_GET[ 'taxonomy' ], $taxes) && $pagenow == 'edit-tags.php' ) {
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@chrisquinnr
chrisquinnr / ironinstall.sh
Created May 12, 2015 11:16
Installs Iron CLI, then scaffolds up a new project in your current directory by installing a bunch of awesome packages
#!/bin/bash
# Runs a bootstrapped install for Meteor using iron-cli
npm install -g iron-meteor && iron create newproject && cd newproject && iron add twbs:bootstrap aldeed:collection2 aldeed:autoform aldeed:delete-button aldeed:delete-button accounts-password ian:accounts-ui-bootstrap-3 natestrauser:font-awesome && iron
@chrisquinnr
chrisquinnr / restore.txt
Created January 26, 2016 15:13
mupx mongorestore
1) Copy dump folder to server
scp -r /local_path/to/dump_folder root@111.222.33.4:/remote/path
2) SSH into server
ssh root@111.222.33.4
3) Copy from root of server to inside docker container
@chrisquinnr
chrisquinnr / linden.js
Created April 6, 2016 08:03
Engine behind xkcd 1663
!function (t) {
function e(i) {
if (n[i])return n[i].exports;
var o = n[i] = {exports: {}, id: i, loaded: !1};
return t[i].call(o.exports, o, o.exports, e), o.loaded = !0, o.exports
}
var n = {};
return e.m = t, e.c = n, e.p = "", e(0)
}([function (t, e, n) {
meteor create --bare chimp-testing
cd chimp-testing meteor
@chrisquinnr
chrisquinnr / pre-commit.sh
Created April 5, 2017 08:41 — forked from czardoz/pre-commit.sh
Git pre-commit hook that checks for AWS keys
#!/usr/bin/env bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
EMPTY_TREE=$(git hash-object -t tree /dev/null)
against=$EMPTY_TREE
fi
@chrisquinnr
chrisquinnr / README-Template.md
Created April 5, 2017 08:46 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@chrisquinnr
chrisquinnr / handler.js
Created June 14, 2017 10:08
Serverless function to grab cryptocurrency price data and post to Slack
'use strict';
const apiURL = 'https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=BTC,USD,GBP,ETH';
module.exports.definition = { BTC: 0.1387, USD: 378.43, GBP: 302, ETH: 1 };
module.exports.run = ( mock = false ) => {
const time = new Date();
this.runCryptoCurrencyChecker(mock, time);
console.log(`CryptoTracker ran at ${time}`);