Skip to content

Instantly share code, notes, and snippets.

View kentcdodds's full-sized avatar
馃
working hard to make the world better with software

Kent C. Dodds kentcdodds

馃
working hard to make the world better with software
View GitHub Profile
@kentcdodds
kentcdodds / .bash_profile
Created August 14, 2014 14:59
.bash_profile
#PROMPT STUFF
GREEN=$(tput setaf 2);
YELLOW=$(tput setaf 3);
WHITE=$(tput setaf 7)
function git_branch {
# Shows the current branch if in a git repository
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \(\1\)/';
}
@kentcdodds
kentcdodds / README.md
Created August 19, 2014 16:47
Get length of string in command line

count & clip-count

Add this to your path and make sure to chmod u+x each of them. Then you can run:

count Hello World

# Outputs:
# characters:  11
# spaces: 2
@kentcdodds
kentcdodds / fake.js
Created August 22, 2014 19:28
github contribution graph fake
var colors = [
'rgb(30, 104, 35)', 'rgb(68, 163, 64)', 'rgb(140, 198, 101)', 'rgb(214, 230, 133)', 'rgb(238, 238, 238)'
];
var days = $('#calendar-graph').find('rect.day');
days.css({
fill: colors[4]
});
days.on('click', function(e) {
e.stopPropagation();
$this = $(this);
@kentcdodds
kentcdodds / kentcdodds.md
Created August 22, 2014 22:59
Kent C. Dodds

About Kent C. Dodds

family-pic

The Basics

  • Excited to be working at AtTask!
  • Family Man - Married 3 years to Brooke, we have 2 kids under 3 (Becca & Nathan)
  • BYU Grad (Masters of Information Systems)
  • Love making things. Partial to JavaScript. Angular fan
@kentcdodds
kentcdodds / AngularJS Snippets.md
Last active April 4, 2019 04:06
AngularJS Chrome DevTools Snippets

Angular Snippets

Some snippets for Chrome that I've made or found/modified and thought were useful.

demo

@kentcdodds
kentcdodds / pre-commit
Last active August 29, 2015 14:06
pre-commit concept... check filesizes and run tests... Don't know if this is necessary though...
# Put this in .git/hooks/
#!/bin/bash
PROJECT_ROOT=$(git rev-parse --show-toplevel)
CMD="${PROJECT_ROOT}/hooks/pre-commit.js"
eval ${CMD}
@kentcdodds
kentcdodds / travis-build-badge.js
Last active August 29, 2015 14:06
Travis build badge as a React Component
/** @jsx React.DOM */
'use strict';
var React = require('react');
var BuildBadge = React.createClass({
propTypes: {
owner: React.PropTypes.string.isRequired,
repo: React.PropTypes.string.isRequired,
branch: React.PropTypes.string
@kentcdodds
kentcdodds / utils.js
Created September 18, 2014 13:18
objectWith PropType for react
var utils = {
PropTypes: {
objectWith: function(options) {
return objectWithFn(options, false);
}
}
};
utils.PropTypes.objectWith.isRequired = function(options) {
return objectWithFn(options, true);
@kentcdodds
kentcdodds / gulp-logit.js
Created October 15, 2014 14:44
Log something to the console at a given point in a pipe stream. Was going to make this gulp-logit, but found something else that solved my issue so I'm leaving this here.
// through2 is a thin wrapper around node transform streams
var through = require('through2');
var gutil = require('gulp-util');
var _ = require('lodash-node');
var PluginError = gutil.PluginError;
var PLUGIN_NAME = 'gulp-logit';
// plugin level function (dealing with files)
function gulpLogIt(log) {
@kentcdodds
kentcdodds / startsOrEndsWithMixins.js
Created October 17, 2014 18:02
starts and ends with mixins
(function() {
'use strict';
_.mixin({
startsWith: function startsWithMixin(s1, s2) {
return startsOrEndsWith(_.first, s1, s2);
},
endsWith: function endsWithMixin(s1, s2) {
return startsOrEndsWith(_.last, s1, s2);
}
});