This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/29299786/512507 | |
def self.valid_id?(id) | |
case id | |
when /^[a-zA-Z0-9]{15}$/ | |
return true | |
when /^[a-zA-Z0-9]{18}$/ | |
id[15..17] == [ | |
id[0..4], | |
id[5..9], | |
id[10..14] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
require 'json' | |
class Elasticsearch | |
class << self | |
attr_accessor :url | |
def configured? | |
url.present? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this file in config/initializers | |
require 'openssl' | |
class RSolrWithWebsolrAuth | |
attr_reader :secret | |
def initialize(secret) | |
@secret = secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install build-essential libgtk2.0-dev libsdl-dev | |
mkdir nestopia | |
cd nestopia | |
wget -O Nestopia140src.zip http://prdownloads.sourceforge.net/nestopia/Nestopia140src.zip?download | |
wget http://rbelmont.mameworld.info/nst140_lnx_release_h.zip | |
unzip Nestopia140src.zip | |
unzip nst140_lnx_release_h.zip | |
make | |
mkdir -p ~/.nestopia | |
touch ~/.nestopia/nstcontrols |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#spec/features/home_spec.rb | |
require 'spec_helper' | |
describe 'Home page' do | |
it 'should be searchable' do | |
visit '/' | |
page.should be_searchable | |
end | |
end |