Skip to content

Instantly share code, notes, and snippets.

View supairish's full-sized avatar
🏂
Shreddin

Chris Irish supairish

🏂
Shreddin
View GitHub Profile
@supairish
supairish / etc-hosts-on-win.md
Created May 23, 2019 06:18 — forked from zenorocha/etc-hosts-on-win.md
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@supairish
supairish / capybara.rb
Created February 23, 2019 07:10 — forked from guzart/capybara.rb
Capybara configuration to run a webpack dev server for e2e testing
# spec/support/capybara.rb
require 'capybara/rails'
require 'capybara/rspec'
# port and url to webpack server
WEB_TEST_PORT = '5005'.freeze
WEB_TEST_URL = "http://localhost:#{WEB_TEST_PORT}".freeze
def capybara_wait_for_webpack_server
10.times.each do |_|
@supairish
supairish / Integrate Gem Engine and main Rails app
Last active March 21, 2019 23:34 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
# Integrate Gem/Engine and main Rails app
## Overview
- [Paths](#paths)
- [Routes](#routes)
- [Add functionality to controller](#controllers)
- [Improving (Extending or overriding) Engine functionality](#extend-engine-class)
- [Helpers](#helpers)
- [Assets](#assets)
@supairish
supairish / echo.rb
Created February 6, 2019 22:40 — forked from dtchepak/echo.rb
Simple Ruby HTTP server to echo whatever GET or POST requests come through. Largely based on https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/.
# Reference: https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/
require 'webrick'
class Echo < WEBrick::HTTPServlet::AbstractServlet
def do_GET(request, response)
puts request
response.status = 200
end
def do_POST(request, response)
puts request
@supairish
supairish / libreadline_6_not_found.sh
Created February 5, 2019 23:39 — forked from wbotelhos/libreadline_6_not_found.sh
Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@supairish
supairish / postgres-brew.md
Created February 1, 2019 17:51 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@supairish
supairish / .bash_prompt
Created January 15, 2019 23:52 — forked from shmatov/.bash_prompt
Bash prompt with rvm, nvm, virtualenv and git integration.
function __git_dirty {
git diff --quiet HEAD &>/dev/null
[ $? == 1 ] && echo " ↺ "
}
function __git_branch {
__git_ps1 "%s"
}
function __my_rvm_ruby_version {
@supairish
supairish / example_activejob.rb
Created September 27, 2018 07:22 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@supairish
supairish / rails http status codes
Created September 26, 2018 21:29 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@supairish
supairish / test_ssl_webrick.rb
Created September 19, 2018 17:00 — forked from twalpole/test_ssl_webrick.rb
Test of webrick configured with self signed cert
html = DATA.read
require "capybara/dsl"
require "capybara/poltergeist"
require "openssl"
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, debug: true, js_errors: true, timeout: 60, logger: $stdout,
phantomjs_options: %w[--load-images=yes --ignore-ssl-errors=yes])