Skip to content

Instantly share code, notes, and snippets.

View FormService.js
var forms = require('forms');
var fields = forms. fields,
validators = forms.validators,
widgets = forms.widgets;
var _ = require('lodash');
var fs = require('fs');
function repl(str,arr) {
_.forOwn(arr,function(value,key) {
var search = '{'+key+'}';
@drmikecrowe
drmikecrowe / README.md
Last active Aug 29, 2015
Reformat Gherkin test scripts to line up properly
View README.md

Setup/Configuration

Here's how our tests are setup:

  • Tests are grouped in subdirectories
  • Each directory/filename is prefixed with a number between 100-999, typically incremented by 10. This allows us to insert new tests into the stream of sequential tests
  • Tests start at 100, but configuration setup tests start at 010.
  • Tests are tagged according to the directory, and directory/file

This is very easy to understand/use, especially when you get 1000s of steps/scenarios and complex tests in your setup.

View app.yml
---
# file: roles/app/tasks/main.yml
- name: ensure logging directory exists
file: path=/var/log/acme state=directory
tags:
- install
- name: ensure config directory exists
file: path=/etc/acme/app state=directory
View generate-compose.sh
docker-yml() {
docker inspect -f $'
{{.Name}}
image: {{.Config.Image}}
entrypoint: {{json .Config.Entrypoint}}
environment: {{range .Config.Env}}
- {{.}}{{end}}
' $1
}
@drmikecrowe
drmikecrowe / reindex-db.js
Last active Jul 25, 2016
Complex indices (and post-create index) of Waterline models
View reindex-db.js
/**
* FILE: api/hooks/reindex-db.js
*
* Created by mcrowe on 1/28/15.
*
* Insures indices recreated if needed, and allows complex indicies to be specified in the model as well. Example:
*
module.exports = {
schema : true,
version : "1.3",
@drmikecrowe
drmikecrowe / Dockerfile
Created Jan 14, 2017
Working PHP Docker Compose System with PhantimJS testing
View Dockerfile
# Build using docker build -t php-drmikecrowe
FROM php:5.6-apache
MAINTAINER Emilien Kenler <hello@emilienkenler.com>
RUN apt-get update && apt-get install -y git libpq-dev libmcrypt-dev zlib1g-dev libicu-dev g++ graphviz && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install pdo_pgsql pdo_mysql mbstring mcrypt zip sockets intl bcmath mysqli
RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar && \
View cron_helper.sh
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@drmikecrowe
drmikecrowe / find_latest_ubuntu_amis.sh
Last active Oct 13, 2017 — forked from antimius/find_latest_ami.sh
Script to find and print the latest stable, Ubuntu version
View find_latest_ubuntu_amis.sh
#!/bin/bash
# prints latest, stable, HVM, EBS GP2 backed AMIs for major OSs
UBUNTU=099720109477
REGIONS="us-east-1 us-east-2 us-west-1 us-west-2"
for REGION in $REGIONS; do
echo -n "$REGION: "
aws ec2 describe-images --region=$REGION --owners $UBUNTU --filters 'Name=name,Values=*hvm-ssd*16.04*' --query 'Images[*].[ImageId,CreationDate,Name]' --output text | sort -k2 -r | head -n 1
@drmikecrowe
drmikecrowe / search-aws-amis.sh
Created Oct 13, 2017
Search for the latest releases for a given search string. Assumes that vendors release in bulk, so it looks for over 2 images released in a day and shows those matches
View search-aws-amis.sh
#!/bin/bash
LINES=6
if [ $# -ne 1 ];then
echo "Usage:"
echo " $0 keyword"
exit 1
fi
View make.log
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.2b1
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 4 changed, 0 removed
reading sources... [ 25%] leo.core
reading sources... [ 50%] leo.external
reading sources... [ 75%] leo.external.concurrent.futures
reading sources... [100%] leo.plugins
Can not import path from plugin leo.plugins.at_view
You can’t perform that action at this time.