Skip to content

Instantly share code, notes, and snippets.

@RobDoan
RobDoan / cypress-cra.md
Created March 19, 2023 03:27 — forked from textbook/cypress-cra.md
Adding Cypress to a Create React App app

Here is how to add Cypress E2E tests to a Create React App bootstrapped application. Assumes the *nix command line, you may need to adapt this for a Windows command line (or use WSL or Git Bash).

  1. Install Cypress and the Testing Library utilities for it (to match the helpers CRA installs):

    $ npm i {,@testing-library/}cypress

    i is short for install, and the braces {} are expanded by brace expansion to cypress @testing-library/cypress.

@RobDoan
RobDoan / postgres_queries_and_commands.sql
Created November 12, 2021 13:30 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
class TemplateProcessor
attribute_reader :vendor_templates
def initialize(templates)
@vendor_template = templates
end
def process(code)
vendor_templates.reduce(code) do |result, vendor_template|
vendor_template.process(code)
@RobDoan
RobDoan / .scss-lint
Created October 16, 2017 14:24
.scss-lint for rails prokect
# Default application configuration that all configurations inherit from.
scss_files:
- 'app/assets/stylesheets/**/*.scss'
- 'app/javascript/styles/**/*.scss'
exclude:
- 'app/assets/javascript/styles/vendors/**/*.scss'
plugin_directories: ['.scss-linters']
# List of gem names to load custom linters from (make sure they are already
# installed)
@RobDoan
RobDoan / .csscomb.json
Created October 16, 2017 14:21
.csscomb.json for rails project
{
"include": [
"app/assets/stylesheets/**/*.scss",
"app/javascript/styles/**/*.scss"
],
"exclude": [
".git/**",
"node_modules/**",
"vendor/**/*"
],
@RobDoan
RobDoan / gist:213367c5d159babb11aa0417c2351c44
Created September 11, 2017 21:54
Switch To New Tab Cucumber
When /^I access the new tab$/ do
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
end
@RobDoan
RobDoan / .gitignore
Created August 13, 2017 13:17 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@RobDoan
RobDoan / rspec_rails_cheetsheet.rb
Created July 26, 2017 18:19 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@RobDoan
RobDoan / .rubocop.yml
Last active October 16, 2017 14:22
My prefer rubocop config
require:
- rubocop-rspec
#inherit_from: .rubocop_todo.yml
Rails:
Enabled: true
AllCops:
TargetRubyVersion: 2.4
Exclude:
require 'rubygems'
require "opengl"
require "glut"
require 'RMagick'
require "glu"
module Panorama
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600