Skip to content

Instantly share code, notes, and snippets.

View shmdt's full-sized avatar
💭
🇺🇦

Kovalenko Anton shmdt

💭
🇺🇦
View GitHub Profile
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@shmdt
shmdt / cloudSettings
Last active January 19, 2020 19:00 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
{"lastUpload":"2020-01-19T18:59:50.579Z","extensionVersion":"v3.4.3"}
@shmdt
shmdt / gist:8df223441838a5d60521e2caa79d4bb1
Created February 3, 2019 18:33 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@shmdt
shmdt / cucumber-rails.md
Created January 31, 2019 09:39 — forked from stepheneyer/cucumber-rails.md
BDD testing using Cucumber, Capybara, and Rails

#Cucumber and Capybara - Behavior Driven Development

##Overview

Cucumber allows software developers to describe how software should behave in plain text. The text is written in a business-readable, domain-specific language. This allows non-programmers to write specific feature requests that can be turned into automated tests that drive development of the project.

Capybara is the largest rodent known to man.

@shmdt
shmdt / terminal-git-branch-name.md
Created November 28, 2018 13:52 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@shmdt
shmdt / rails-jsonb-queries
Created April 11, 2018 06:57 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@shmdt
shmdt / gist:67229e42a6160c2c95ce336bf27b3625
Created September 14, 2017 12:21 — forked from i556/gist:1661623
Cross Domain iframe Resizing
http://mohumohu/parent.html
http://hogehoge.com/iframe.html
//parent.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
@shmdt
shmdt / Gemfile
Last active June 19, 2017 09:15 — forked from ctalkington/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@shmdt
shmdt / sinatra_render_html.rb
Created May 24, 2017 08:25 — forked from kinopyo/sinatra_render_html.rb
How to render static HTML files in Sinatra.
require 'sinatra'
get '/' do
File.read(File.join('public', 'index.html'))
# or
# send_file File.join(settings.public, 'index.html')
end
@shmdt
shmdt / sphinx-macosx.sh
Created April 14, 2017 07:41 — forked from ubermuda/sphinx-macosx.sh
Installing sphinxsearch on macosx
# first sphinx
brew install sphinx
# the formula does not install libsphinxclient :/
wget http://sphinxsearch.com/files/sphinx-2.0.4-release.tar.gz
tar xzf sphinx-2.0.4-release.tar.gz
cd sphinx-2.0.4-release/api/libsphinxclient/
CXXCPP="gcc -E" ./configure --prefix=/usr/local
make
make install