Skip to content

Instantly share code, notes, and snippets.

View mcshakes's full-sized avatar

Mac McCarthy mcshakes

View GitHub Profile
@mcshakes
mcshakes / Rails C error.
Created October 14, 2016 23:45
Running into RVM and readline issues
$ rails c
Running via Spring preloader in process 7916
/Users/edmac/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found - /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Fixed with:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@mcshakes
mcshakes / OpenSSL_Errors.md
Last active December 17, 2016 21:23
OpenSSL Errors; Mokey in the Middle attacks blah blah

My full list of nonsense upon running bundle install

$ bundle install Fetching source index from https://rubygems.org/ Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.

There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.

Like a chump, I gem update --system and got:

@mcshakes
mcshakes / watir-6-update.md
Last active January 9, 2017 22:07
Upgrading to watir 6 and selenium-webdriver 3

The Error in Console:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': require "watir-webdriver" is deprecated. Please, use require "watir"

I didn't have RVM or Homebrew installed, so steps were a bit longer than expected

Open a terminal to see the list of installed rubies: rvm list

  1. See available rubies for installation: rvm list known
  2. Install a new version ruby (e.g. 2.1.4): rvm install 2.1.4
@mcshakes
mcshakes / openssl-errors.md
Last active March 16, 2017 21:11
OpenSSL errors when I run rspec with watir 6.0

Getting these errors after rspec

/Users/EdwardMcCarthy/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin14/openssl.bundle: warning: already initialized constant OpenSSL::VERSION
/Users/EdwardMcCarthy/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin14/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/Users/EdwardMcCarthy/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/x86_64-darwin14/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION

The fix:

After npm init and you do all that noise, for setup
  1. npm install --save-dev webpack webpack-dev-server babel-loader babel-core

Note: insert react-hot-loader and react etc, if you are working on React projects

example: npm install --save react react-dom history react-router

  1. touch webpack.config.js and add this boilerplate:
@mcshakes
mcshakes / String Drills
Created January 7, 2018 23:56
Unit 2 / Lesson 2 / Project 3
function wisePerson(wiseType, whatToSay) {
return `A wise ${wiseType} once said: ${whatToSay}`;
// return 'A wise ' + wiseType + ' once said: "' + whatToSay + '".';
}
SHOUTER
function shouter(whatToShout) {
return whatToShout.toUpperCase();
AREA OF RECTANGLE
function computeArea(width, height) {
return width * height;
}
TEMPERATURE CONVERSION
function celsToFahr(celsTemp) {
return celsTemp * (9 / 5) + 32
TRAFFIC LIGHTS
https://repl.it/@mcshakes/Traffic-lights-drill
HANDLING ERRORS
https://repl.it/@mcshakes/Error-alert-drill
CREATING ARRAYS
https://repl.it/@mcshakes/Creating-arrays-drill
ADDING ARRAY ITEMS
https://repl.it/@mcshakes/Creating-arrays-drill
ACCESSING ARRAY ITEMS
ARRAY COPYING I
https://repl.it/@mcshakes/Array-copying-I-drill
ARRAY COPYING II
https://repl.it/@mcshakes/Array-copying-II-drill
SQUARES WITH MAP