Skip to content

Instantly share code, notes, and snippets.

version: 2
jobs:
build:
working_directory: ~/circleci-demo-ruby-rails
docker:
- image: circleci/ruby:2.4.1-node
environment:
RAILS_ENV: test
PGHOST: 127.0.0.1
PGUSER: root
@Mifrill
Mifrill / Capybara.md
Last active January 1, 2018 12:36 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
```
db.getSiblingDB('connect-api-dev').getCollection('jobs').getIndexes()
db.getSiblingDB('connect-api-dev').getCollection('jobs').createIndex({ 'name': 1, workspace: 1 }, { unique: true, partialFilterExpression: { 'name': { $type: 'string' } } }
[
{
$group: {
_id: "$name",
count: { $sum: 1 },
docs: { $push: "$$ROOT" }

CURL

curl -X POST "http://localhost:5000/api/v1/tokens" -d '{"auth": {"email": "editor", "password": "123"}}' -H "Content-Type: application/json"
-------------------------------------------------------------------------------------------
curl -H "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0OTQ3ODQ1NzAsInN1YiI6Mn0.8QlJbibo2nosDSVnlYtcadJ8VFQFiaBzNueLQDDwCmU" http://localhost:5000/api/v1/pages
-------------------------------------------------------------------------------------------

Postman

shift + l - jump to line in github
count - | wc -l
first - | head -n 1
last - | tail -n 1
pretty-print: `| python -m json.tool`
ls -la
@Mifrill
Mifrill / PG::Error: ERROR: new encoding (UTF8) is incompatible
Created January 8, 2018 07:36 — forked from amolkhanorkar/PG::Error: ERROR: new encoding (UTF8) is incompatible
Postgres PG::Error: ERROR: new encoding (UTF8) is incompatible
======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
mifrill@mifrill-desktop:~/Documents$ ls
comments.xls
mifrill@mifrill-desktop:~/Documents$ ruby -v 
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
mifrill@mifrill-desktop:~/Documents$ gem install roo
Fetching: rubyzip-1.2.1.gem (100%)
Successfully installed rubyzip-1.2.1
Fetching: roo-2.7.1.gem (100%)
Successfully installed roo-2.7.1
git reset --hard --recurse-submodule

git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive

@Mifrill
Mifrill / docker.md
Last active December 3, 2018 16:18

ElasticSearch

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.0.1

install docker image

sudo docker build -t {image_name} . sudo docker run -i -t -v {project_local_path}:/railgun -p {outPort}:{inside port} {image_name}

example

sudo docker run -i -t -v ~/Desktop/Ruby/railgun/:/railgun -p 5000:3000 railgun-browser

sudo docker ps