Skip to content

Instantly share code, notes, and snippets.

@damjack
damjack / README.md
Last active October 1, 2022 22:24 — forked from webdev1001/gist:e848abef8064c55c2f6443a282f75651
Array values in the parameter to `Gem.paths=` are deprecated.

Array values in the parameter to Gem.paths= are deprecated. Please use a String or nil. An Array (...) was passed in from bin/rails:3:in `load'

Solution

ruby/rubygems#1551

If you came to this issue by googling the error specified in the description of this issue, you should know that it has already been fixed in spring-1.6.4 and all you need to do is to update to latest spring and regenerate binstubs, like this:

@damjack
damjack / aaa.md
Last active February 4, 2019 16:20
First React Lesson

React Lessons

https://codesandbox.io

  1. Create a div with a text content "Hello World" and with a stylesheet class "container"
  • VANILLA JS
  • REACT JS
  • JSX
  1. Create a function Message that uses two props, a property "c" for className and a property "txt" for text and return a div with the text styled with that css class
@damjack
damjack / update-forcked-github.md
Last active January 18, 2019 12:00
Update a GitHub forked repository

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

Make sure that you're on your master branch:

@damjack
damjack / gist:816a30c0ec46662690750d2733893ae4
Created August 28, 2018 10:38 — forked from hpjaj/gist:ef5ba70a938a963332d0
RSpec - List of available Expectation Matchers - from Lynda.com course 'RSpec Testing Framework with Ruby'
## From Lynda.com course 'RSpec Testing Framework with Ruby'
describe 'Expectation Matchers' do
describe 'equivalence matchers' do
it 'will match loose equality with #eq' do
a = "2 cats"
b = "2 cats"
expect(a).to eq(b)

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjE1Njg2OTg4
ODMgMC4xNzI0OTg3MzI4IDAuMjAzODUxNTgwNiAxTxAnMC4xMTc4NDk5NjA5IDAuMTI4
" We're running Vim, not Vi!
execute pathogen#infect()
" Enable syntax highlighting
syntax on
" Enable filetype detection
filetype on
" Enable filetype-specific indenting
filetype indent on
" Enable filetype-specific plugins
filetype plugin indent on
@damjack
damjack / 1rails-rbenv.md
Last active June 28, 2018 21:54
Start with Rails on Mac OS

Install Ruby with rbenv on Mac OS

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

First, install Homebrew

Homebrew (or just brew, since that's the name of the command you'll use), is a package manager for Mac OS. It make installing all sorts of cool tools easy.

@damjack
damjack / psql-ssh-tunnel.md
Created May 25, 2018 21:51 — forked from noteed/psql-ssh-tunnel.md
SSH tunnel for PostgreSQL connection

SSH tunnel for PostgreSQL connection

Create a .pgpass file that will be used to provide the password for any libpq-based program for the matching hostname/port/database/user. That file should be chmod'd 0600.

> cat .pgpass
127.0.0.1:5433:database:user:password

Create a SSH tunnel: we open the local port 5433 and, out of the tunnel, go to localhost:5432. You probably really want localhost and not remote: your PostgreSQL database is probably accepting connections only from locahost.

> ssh -N -L 5433:localhost:5432 user@remote

@damjack
damjack / activestorage.md
Created April 24, 2018 06:49
Active Storage configuration

Rails Active Storage: Uploading files to Amazon S3

setup

add gem into Gemfile:

gem "rails", ">= 5.2.0.rc2"

install new gem with: