Skip to content

Instantly share code, notes, and snippets.

View tomas-stefano's full-sized avatar

Tomas D'Stefano tomas-stefano

  • Ministry of Justice
  • London
View GitHub Profile
@tomas-stefano
tomas-stefano / Capybara.md
Last active May 2, 2024 05:16
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@tomas-stefano
tomas-stefano / Readme.md
Last active January 18, 2023 13:56
Pre commit ruby script

Pre-commit hook

This is a pre-commit script that will see the git diff and run the appropriate checks like JSHint and Rubocop

You can add to your .git/hooks of any repo that you like.

Notes

  1. Don't forget to add the executable permission to this file and have the following installed:
@tomas-stefano
tomas-stefano / Gemfile
Last active June 4, 2020 13:40
DEFRA to MoJ metadata (a simple version)
gem 'rspec'
@tomas-stefano
tomas-stefano / receive.py
Created April 1, 2012 16:06
RabbitMQ example in Python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
def callback(ch, method, properties, body):
print "[x] Received: %r" % (body,)
channel.basic_consume(callback, queue='hello', no_ack=True)
@tomas-stefano
tomas-stefano / receive.py
Created August 20, 2011 03:52
RabbitMQ example in python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
def callback(ch, method, properties, body):
"""docstring for callback"""
print "[x] Received: %r" % (body,)
@tomas-stefano
tomas-stefano / read_session.rb
Last active July 21, 2017 13:07
Read yaml/erb files
session_config_file = File.read('config/session_expiration.yml')
session_config = YAML.load(ERB.new(session_config_file).result(binding))
session_config['expiration_time'] # => 1800 seconds (30 minutes)
@tomas-stefano
tomas-stefano / karma.txt
Created July 17, 2017 10:25
Notes. It is about karma
Install karma-cli globally:
* npm i -g karma-cli
Set up the project:
* npm init
* npm i --save-dev karma
* karma init
* Use the following responses when prompted:
* Which testing framework do you want to use?
* mocha
Documentation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Metrics/LineLength:
Max: 80
Metrics/MethodLength:
Max: 15
Metrics/ModuleLength:
Exclude:
@tomas-stefano
tomas-stefano / Gemfile
Last active May 30, 2017 13:20
PRs list from mas
gem 'octokit'

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software