Skip to content

Instantly share code, notes, and snippets.

@nhoag
nhoag / capybara-cheat-sheet.md
Last active August 29, 2015 14:08 — forked from zhengjia/capybara cheat sheet
Common Capybara code snippets

Navigating

    visit('/projects')
    visit(post_comments_path(post))

Clicking links and buttons

// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
{
"title": "Apache Overview",
"services": {
"query": {
"list": {
"2": {
"id": 2,
"type": "topN",
"query": "",
"alias": "",
{
"title": "Apache logs",
"services": {
"query": {
"list": {
"0": {
"query": "*",
"alias": "",
"color": "#7EB26D",
"id": 0,
  1. General Background and Overview
@nhoag
nhoag / gpg-import-and-export-instructions.md
Created January 2, 2016 14:19 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@nhoag
nhoag / 9191_config.php
Created February 4, 2016 15:43
This is a sample addition to the config.php for SimpleSAMLphp for Acquia Cloud.
<?php
// All custom changes below. Modify as needed.
// Defines account specific settings.
// $ah_options['database_name'] should be the Acquia Cloud workflow database name which
// will store SAML session information.set
// You can use any database that you have defined in your workflow.
// Use the database "role" without the stage ("dev", "stage", or "test", etc.)
$ah_options = array(
'database_name' => 'mydatabasename',
'session_store' => array(
@nhoag
nhoag / pre-push.sh
Created September 6, 2016 18:00 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@nhoag
nhoag / sphp.sh
Last active May 7, 2019 19:26 — forked from w00fz/sphp.sh
PHP switcher
#!/bin/bash
# Check if command was run as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage