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 "gsadmin/engine" | |
require "rails" | |
module Gsadmin | |
class Engine < Rails::Engine | |
end | |
def self.config(&block) | |
yield Engine.config if block | |
Engine.config |
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
def check_if_rails_project | |
abort = 0 | |
unless File.exists?("Gemfile") | |
say "Missing Gemfile! Is this a rails project? If yes, something went really wrong, create your Gemfile and retry", :red | |
abort = 1 | |
end | |
unless File.exists?(Rails.root.join("config/routes.rb")) | |
say "Missing routes.rb! Is this a rails project? If yes, something went really wrong, create your routes.rb and retry", :red | |
abort = 1 | |
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
class AddIndexesToTables1 < ActiveRecord::Migration | |
def change | |
add_index(:adverts, :category_id) | |
add_index(:adverts, :profile_id) | |
add_index(:adverts, :video_id) | |
add_index(:adverts, :active) | |
add_index(:advert_area_mappings, :advert_id) | |
add_index(:advert_area_mappings, :area_id) |
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
# encoding: utf-8 | |
require "fileutils" | |
img=Dir.glob("**/*.jpeg")+Dir.glob("**/*.jpg")+Dir.glob("**/*.png")+Dir.glob("**/*.gif") | |
data=Dir.glob("**/*.htm*")+Dir.glob("**/*.css*")+Dir.glob("**/*.js*") | |
puts img.length.to_s+" images found & "+data.length.to_s+" files found to search against" | |
content="" |
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
{ | |
"data": { | |
"current_condition": [ | |
{ | |
"cloudcover": "1", | |
"humidity": "54", | |
"observation_time": "10:14 AM", | |
"precipMM": "0.0", | |
"pressure": "1013", | |
"temp_C": "7", |
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
users= | |
{ | |
username1="password", | |
username2="password", | |
} | |
realms= | |
{ | |
{ | |
name="My realm...", |
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
configuration= | |
{ | |
daemon=false, | |
pathSeparator="/", | |
logAppenders= | |
{ | |
{ | |
name="console appender", | |
type="coloredConsole", |
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
... | |
describe "GET 'delete'" do | |
before :each do | |
@upload = create(:upload) | |
end | |
it "deletes the upload" do | |
expect{ | |
delete :destroy, id: @upload | |
}.to change(Upload, :count).by(-1) |
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
VCR.configure do |c| | |
c.ignore_localhost = true | |
c.cassette_library_dir = Rails.root.join("spec", "vcr") | |
c.hook_into :webmock | |
end | |
RSpec.configure do |c| | |
c.treat_symbols_as_metadata_keys_with_true_values = true | |
c.around(:each, :vcr) do |example| | |
name = example.metadata[:full_description].split(/\s+/, 2).join("/").underscore.gsub(/[^\w\/]+/, "_") |
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
def omniauth_facebook | |
OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new({ | |
:provider => 'facebook', | |
:uid => '1234567', | |
:info => { | |
:nickname => 'jbloggs', | |
:email => '[email protected]', | |
:name => 'Joe Bloggs', | |
:first_name => 'Joe', | |
:last_name => 'Bloggs', |