Skip to content

Instantly share code, notes, and snippets.

/**
* Sugar for has(int, isAssignableFrom(Class)).
*
* Example: onView(rootView).check(has(3, EditText.class);
*/
public static ViewAssertion has(final int expectedCount, Class<? extends View> clazz) {
return has(expectedCount, isAssignableFrom(clazz));
}
/**
@proverbed
proverbed / mongodbcheats.js
Created October 12, 2016 06:40 — forked from kgorman/mongodbcheats.js
MongoDB cheat sheet
/* MongoDB cheat sheet */
// replication lag via serverStatus()
db._adminCommand( { serverStatus : 1 , repl ; 2 } )
// stats
db.stats()
db.foo.stats()
// size of BSON of some query
@proverbed
proverbed / fix-rabbitmq-after-disk-space-full.markdown
Created January 28, 2017 16:25 — forked from christopher-hopper/fix-rabbitmq-after-disk-space-full.markdown
How to recover RabbitMQ after running out of disk space

If RabbitMQ wont start and show the following in the startup logs:

# cat  /var/log/rabbitmq/startup_log


BOOT FAILED
===========
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@proverbed
proverbed / mocha-guide-to-testing.js
Created September 23, 2017 10:59 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@proverbed
proverbed / gist:88fcdfa9c34ddb6afb504a03af22228d
Created October 6, 2017 05:39 — forked from learncodeacademy/gist:5f84705f2229f14d758d
Getting Started with Vagrant, SSH & Linux Server Administration
@proverbed
proverbed / docker.md
Last active May 4, 2018 12:22
docker cheatsheet

Link the harmonic api and docker compose network

docker run -t -i --link harmonic-api --net composetest_default 44927adc5d84 /bin/bash

Stop all docker containers

docker stop $(docker ps -a -q)

Remove all docker containers

docker rm $(docker ps -a -q)

Execute command in running container

@proverbed
proverbed / curl.md
Created May 23, 2018 19:54 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@proverbed
proverbed / pre-commit
Last active August 29, 2018 13:57 — forked from guilherme/gist:9604324
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='debugger\|console.log\|.only'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@proverbed
proverbed / ultimate-ut-cheat-sheet.md
Created September 7, 2018 05:17 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies