Skip to content

Instantly share code, notes, and snippets.

View klamping's full-sized avatar

Kevin Lamping klamping

View GitHub Profile
@klamping
klamping / gist:7104237
Created October 22, 2013 16:59
Build your own CSS regression testing tool
Script to build URLs
https://github.com/cgiffard/node-simplecrawler
Script to build CSS selector file
https://github.com/caplin/SuperSelector
http://selectorgadget.com/
Script to convert :hover, :focus, etc to .hover, .focus etc
https://github.com/jacobrask/styledocco/blob/master/share/previews.js
Apply for any selectors that match
@klamping
klamping / gist:7589060
Last active December 29, 2015 00:49
Behaviors that hamper productivity
  • Prioritize admin work over actual productive work
  • Talk about improving things "in the future", without listing out specific POCs, timelines, etc.
  • Treat everything as priority #1
  • Answer every e-mail
  • Defer decisions until you can "meet" to talk about the situation
  • Don't move forward with a quick solution because you already have a similar solution "just around the corner"
    • "just around the corner" is usually much farther than you think
  • Treat similar solutions as mutually exclusive
  • Instead of addressing the root cause as to why certain work isn't getting done, start a competition with the possibility of a prize as "incentive" for people to work on something.
  • Postpone important project work into the far future since "funding isn't available yet".
@klamping
klamping / ng-diaper.js
Last active August 29, 2015 14:02
ng-diaper
angular.directive('ngDiaper', function ($rootScope, $timeout, wipesSvc) {
return {
replace: true,
priority: 1000,
restrict: 'E',
// TODO for some reason, even though we're trying to isolate the scope, properties inside this directive keep leaking out
scope: true,
template: '<form name="diaper" ng-submit="changeDiaper()"><input type="submit" id="plumbing"></form>',
link: function (scope, el) {
scope.changeDiaper = function () {
@klamping
klamping / writeup.md
Last active February 7, 2018 17:58
Wraith-Travis Integration

Easy UI Regression Testing with Wraith and TravisCI

Introduction

In the past four years, I've learned the hard way about how painful it can be to try and update a codebase used by a large number of applications. Changes that seem innocent can break a specific use case that wasn't anticipated. Do enough manual regression testing and you will catch the bugs, but it's' costly and time consuming process. When things are costly and time consuming, they usually stop being done.

This is why I focus a lot of my efforts towards build process automation. Computers are fantastic about doing boring, repetitive work and never complaining. If you can get them to do the boring chores for you, you spend more time doing the fun, challenging work.

UI Regression testing is one of those spots where I'm looking for automation scripts to take over. Not only because playing "spot the difference" between your builds is boring, but also because [we're horrible at it](http://en.wikipedia.org/wiki/Chan

/* jshint node: true */
describe('rxFeedback', function () {
var scope, compile, rootScope, el, feedbackSvc, apiUrl, httpMock, notifySvcMock, screenshotSvcMock, elScope;
var validTemplate = '<rx-feedback></rx-feedback>';
var theScreenshot = 'the screenshot';
var feedback = {
type: {
label: 'type'
},
@klamping
klamping / prs.js
Created September 16, 2014 00:14
List all open PRs for repos
#!/usr/bin/env node
// Run with `node prs.js`
// or chmod the file and run via `./prs.js`
/*jshint node:true*/
var https = require('https');
var util = require('util');
var options = {
@klamping
klamping / part-1.md
Last active August 29, 2015 14:07
How I've Messed up in Angular

Part 1 - Factories vs. Services

I thought I understood the difference between Factories and Services fairly clearly. I made the assumption that factories, by their name, were useful for pumping out new instances of objects every time you asked for them. I also held the belief that services were simply a nomenclature for defining a set of utility functions for tracking state or some sort of data.

Well, forget what I just said, because I had it wrong. Factories and services are actually pretty similar in functionality (assuming I'm not getting it wrong yet again). They both serve the purpose of instantiating a singleton object; something that you're going to use as a single instance throughout your page lifecycle.

The main difference between factories and services is how you define them. Services should build off of the this object. Factories should return a custom object with functionality attached to it.

Service:

Name ideas:
Beurocracy
Too many cooks
Mechanic of game
Each player adds X tiles to a common deck. Tiles are shuffelled and X number are drawn randomly as a community. The tiles that are drawn are actions taken by the player whose tile was drawn.
Example actions:
Attack
- Quell monsters
Team vs. performance
Last 3 games
Last game
- Regression to mean
Travelling East
Injuries
@klamping
klamping / scrollerific.js
Created February 2, 2015 16:32
Scroll thingy
// Container element to add/remove class to
var container = $('body')
// this is the class that will be added to the body tag when the page is scrolled down
var scrollClass = "window-scrolled";
// how far down the page needs to be scrolled for the class to be added
var positionTrigger = 10;
$(window).scroll(function (event) {