Skip to content

Instantly share code, notes, and snippets.

Avatar

Alfred Rowe nukturnal

View GitHub Profile
@djonsson
djonsson / install_elasticsearch_osx.md
Last active Apr 27, 2021
OS X installation instructions for Elasticsearch + Kibana + Marvel
View install_elasticsearch_osx.md

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@doitian
doitian / my_api.rb
Created Dec 25, 2011
Allow cors from any domain
View my_api.rb
class MyAPI < Grape::API
class CrossOriginResourceSharingPolicy < Grape::Middleware::Base
def append_cors_headers(headers)
headers['Access-Control-Allow-Origin'] = env['HTTP_ORIGIN'] || '*'
headers['Access-Control-Allow-Credentials'] = 'true'
headers['Access-Control-Max-Age'] = '180'
if env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
headers['Access-Control-Allow-Headers'] = env['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']
end
headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, DELETE, OPTIONS'
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')