Skip to content

Instantly share code, notes, and snippets.

@boddhisattva
boddhisattva / setup_system_tests_with_rspec_devise_rails6.md
Last active November 9, 2023 20:58
Setup System tests to work with RSpec, Devise and Rails 6

Setting this up took quite a bit of time and research for me, so just thought of sharing the learnings along the way that led to a working setup.

  • Initial error that I was getting with running System tests in Rails 6

    System test integration requires Rails >= 5.1 and has a hard dependency on a webserver and `capybara`, please add capybara to your Gemfile and configure a webserver (e.g. `Capybara.server = :webrick`) before attempting to use system tests.
    • since the error above says specify Capybara in the Gemfile, a part of my Gemfile looked like below:
(* ocaml voronoi.ml *)
#load "graphics.cma";;
open Graphics;;
Random.self_init ();;
Graphics.open_graph " 360x240";;
class point =
object
val mutable x = Random.int 359
val mutable y = Random.int 239
@wojteklu
wojteklu / clean_code.md
Last active May 13, 2024 17:28
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@blelump
blelump / aws_signed_request_v4.rb
Last active December 8, 2022 15:51
Sample Ruby code to create AWS signed request version 4 (with request headers)
#Signing AWS Requests By Using Signature Version 4
#http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
require 'uri'
require 'openssl'
require 'net/http'
require 'cgi'
method = 'GET'
service = 'iam'
@samklr
samklr / install-proto.sh
Created April 20, 2015 08:19
Install Protobuf debian ...
#! /bin/bash
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar xzf protobuf-2.6.1.tar.gz
cd protobuf-2.6.1
sudo apt-get update
sudo apt-get install build-essential
sudo ./configure
sudo make
sudo make check
sudo make install
@florinel-chis
florinel-chis / vtiger-pre-install
Last active April 2, 2020 14:41
Set required permissions on files and folders in order to install VTiger CRM.
cp htaccess.txt .htaccess
echo "php_value memory_limit 1G" >> .htaccess
echo "php_value error_reporting 512" >> .htaccess
chmod 777 config.inc.php
chmod o+w tabdata.php
chmod o+w install.php
chmod o+w parent_tabdata.php
chmod -R o+w cache/
chmod -R o+w storage/
chmod -R o+w install/
@ringe
ringe / newapp.rb
Created February 7, 2012 09:41
Rails Template with Cucumber, RSpec, FactoryGirl, Capybara, Spork, Watchr, Devise on MySQL in a Vagrant environment
# Add to the given file the given lines, after the line with the given text, or replace the content
def add_to_file(path, text, after=nil, replace=false)
lines = []
if replace
lines = text
else
File.readlines(path).each do |line|
if after != nil and line.include?(after)
lines << line
lines << text