Skip to content

Instantly share code, notes, and snippets.

View serby's full-sized avatar
😃
Joyful

Paul Serby serby

😃
Joyful
View GitHub Profile
@serby
serby / setup.sh
Last active February 2, 2019 13:00
# Stop on error
set -e
# Is brew needed?
if [ -x "$(which brew)" ]; then
echo Skipping brew
else
echo Installing brew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
@serby
serby / generate.js
Created January 8, 2014 16:32
Trello to MD in node.js
var Trello = require('node-trello')
, t = new Trello('KEY', 'TOKEN')
t.get('/1/boards/bdLKstEV', function(err, data) {
if (err) throw err
console.log('#', data.name, '\n')
console.log('[Source Trello Board](%s)',data.url)
console.log(data.desc, '\n')
t.get('/1/boards/bdLKstEV/lists?cards=open', function(err, data) {
Table Name | Size | Index Size | Total Size
---------------------------------+------------+------------+------------
CompetitionAnswer | 998 MB | 860 MB | 1857 MB
PageTracking | 273 MB | 114 MB | 387 MB
User | 42 MB | 29 MB | 71 MB
Article | 15 MB | 21 MB | 36 MB
Comment | 14 MB | 22 MB | 36 MB
PollEntry | 11 MB | 18 MB | 30 MB
SearchIndex | 8928 kB | 33 MB | 41 MB
Binary | 7512 kB | 1376 kB | 8888 kB
lib/app.js: line 42, col 36, This function has too many statements. (75) (W071)
lib/backchannel.js: line 70, col 56, This function's cyclomatic complexity is too high. (8) (W074)
lib/jobs.js: line 136, col 17, This function's cyclomatic complexity is too high. (14) (W074)
lib/libconfig.js: line 77, col 20, This function's cyclomatic complexity is too high. (7) (W074)
lib/middleware.js: line 114, col 23, This function's cyclomatic complexity is too high. (7) (W074)
lib/middleware.js: line 220, col 67, This function's cyclomatic complexity is too high. (7) (W074)
@serby
serby / gist:7466705
Last active December 28, 2015 07:49
Front End QA RegExp
# Missing versionPath
# *.jade,*.html
## Link
(^|\s)link.*(href)=(?!versionPath)['"](/\w|\.+/)
## Meta
(^|\s)meta.*(content)=(?!versionPath)['"](/\w|\.+/)
## src - img, iframe, script
// List all tasks with no labels
(function () {
if (document.location.host !== 'www.pivotaltracker.com') {
return alert('This should be run in a console within "www.pivotaltracker.com"')
}
var projectId = document.location.pathname.match(/\d+/)[0]
, teams = ['frontend', 'backend', 'creative', 'technical services']
$.get('https://www.pivotaltracker.com/services/v5/projects/' + projectId + '/stories?limit=999999', function(results) {
@serby
serby / naming.md
Last active December 26, 2015 23:49

Clock JavaScript/JSON Naming Guide

Please ensure you are familiar with our JavaScript styleguide. This guide builds on top of that document and aims to advise on the semantic naming of variable, objects, properties, classes and functions.

Glossary

Object

From Mozilla's JavaScript Glossary

@serby
serby / qa.js
Created October 16, 2013 22:12
console.log finder
function countLines(text) {
var count = 1
, pos = 0
, found = 0
while ((found = text.indexOf('\n', pos)) !== -1) {
count++
pos = found + 1
}
return count
}
var _ = require('lodash')
module.exports = function (actual, expected, ignoreObjectLength, ignoreFunctions) {
/* jshint maxcomplexity: 7 */
if (arguments.length < 2) {
throw new Error('Not enough arguments')
}
function countLines(text) {
var count = 1
, pos = 0
, found = 0
while ((found = text.indexOf('\n', pos)) !== -1) {
count++
pos = found + 1
}
return count
}