Skip to content

Instantly share code, notes, and snippets.

@juliocesar
juliocesar / testing_front_end_rspec_capybara.md
Created October 21, 2010 23:51
Testing front-end for a Sinatra app with RSpec and Capybara

Testing front-end for a Sinatra app with RSpec and Capybara

I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.

A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.

So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.

Gemfile

@rubiojr
rubiojr / rbvmomi_example1.rb
Created September 5, 2011 15:28
Ruby VMWare VSphere API Example 1 (rbvmomi)
require 'rubygems'
require 'rbvmomi'
require 'pp'
require 'alchemist'
hyper = 'thunder03'
vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true
#
# get current time
@jacquescrocker
jacquescrocker / Gemfile
Created October 16, 2012 10:13
Gemfile for DeployButton.com
# deploybtn Gemfile
source 'https://rubygems.org'
gem "rake", ">= 0.9.2"
gem 'rails', ">= 3.2.7"
gem 'json'
gem "rails_config", "0.2.5"
gem "guid"
@webandtech
webandtech / cf.rake
Last active December 18, 2015 19:48
Rake task for deploying a git repo to Cloud Foundry. Based on https://gist.github.com/jamiew/4429547
require 'fileutils'
namespace :cf do
desc 'Deploy to staging on Cloud Foundry'
task :deploy_staging do
cf_target = 'api.run.pivotal.io'
deploy_branch = 'master'
deploy_space = 'staging'
deploy_org = "YOUR ORGANIZATION"
deploy_repo_dir = "tmp/cf_deploy"
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links
@rhaseven7h
rhaseven7h / PS1.sh
Created July 28, 2016 08:23
PS1 Setup with nvm and git branch
export PS1="┏ \[$(tput bold)\]\[$(tput setaf 2)\]\u\[$(tput setaf 7)\]\[$(tput bold)\]@\[$(tput setaf 6)\]\H \[$(tput setaf 3)\][\w]\[$(tput sgr0)\]\n┃ \[$(tput bold)\]\[$(tput setaf 7)\]\d :: \t :: nvm=\$(nvm current) :: branch=\$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo not-a-git-repo) :: Cmd #\!\[$(tput sgr0)\] \n┗ \[$(tput bold)\]\[$(tput setaf 3)\]\\$ \[$(tput sgr0)\]\[$(tput sgr0)\]"
@justinsoliz
justinsoliz / resources.tf
Created August 30, 2016 15:26
Terraform S3 to Lambda notification
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_iam_role" "iam_for_terraform_lambda" {
name = "app_${var.app_env}_lambda"
assume_role_policy = <<EOF
{
@artizirk
artizirk / gnupg_scdaemon.md
Last active July 12, 2024 20:07
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@rams3sh
rams3sh / aws_regex_cheat_sheet
Last active May 7, 2024 11:53
Common AWS Related Regex (AWS)
ARN Base Pattern :-
arn:<aws_parition>:<aws_service>:[<aws_region>]:<account_id>:<root | resource_type>:/<resource_name>[/<sub_resource_names>...]
i. <aws_partition>
Regex - (aws|aws-us-gov|aws-cn)
ii. <aws_service> - No fixed pattern
iii. <aws_region> - No fixed pattern
Most of the regions occur in combination of 2 letter followed by "-" followed by a combination of direction based word , followed by a "-" and then a digit.
@xirkus
xirkus / yubikey+gpupgp+ssh_howto.md
Last active May 8, 2024 08:34
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh