If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.
If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.
| $ brew update && brew doctor # Repeat, until you've done *all* the Dr. has ordered! | |
| $ brew install postgresql # You'll need postgres to do this... you may also need to 'initdb' as well. Google it. | |
| $ brew install elixir | |
| $ mix local.hex # Answer y to any Qs | |
| $ createuser -d postgres # create the default 'postgres' user that Chris McCord seems to like -- I don't create mine w/a pw... | |
| # Use the latest Phoenix from here: http://www.phoenixframework.org/docs/installation -- currently this is 1.0.3 | |
| # ** Answer y to any Qs ** | |
| $ mix archive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ez |
| require 'uri' | |
| require 'net/http' | |
| class RedirectResolver | |
| def self.resolve(uri) | |
| uri_input = uri | |
| if uri.is_a? String | |
| uri = URI.parse(uri) | |
| end |
| # config/initializers/compression.rb | |
| Rails.application.configure do | |
| # Use environment names or environment variables: | |
| # break unless Rails.env.production? | |
| break unless ENV['ENABLE_COMPRESSION'] == '1' | |
| # Strip all comments from JavaScript files, even copyright notices. | |
| # By doing so, you are legally required to acknowledge | |
| # the use of the software somewhere in your Web site or app: |
| module GzipHelper | |
| def gzip_javascript_include_tag(asset) | |
| # Grab the asset html include tag | |
| tag = javascript_include_tag asset | |
| # If we are in production and the requesting client accepts gzip encoding, swap for the gzip asset | |
| if Rails.env.production? && request.accept_encoding =~ /gzip/i | |
| tag = tag.gsub(/\.js/i, ".js.gz") | |
| end |
| module ImagesHelper | |
| # Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags | |
| # for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers. | |
| # | |
| # image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image' | |
| # | |
| # => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image"> | |
| # | |
| def image_set_tag(source, srcset = {}, options = {}) | |
| srcset = srcset.map { |src, size| "#{path_to_image(src)} #{size}" }.join(', ') |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| module Paperclip | |
| class Blur < Processor | |
| def initialize file, options = {}, attachment = nil | |
| super | |
| @format = File.extname(@file.path) | |
| @basename = File.basename(@file.path, @format) | |
| end |
| require "active_record" | |
| namespace :db do | |
| db_config = YAML::load(File.open('config/database.yml')) | |
| db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
| desc "Create the database" | |
| task :create do | |
| ActiveRecord::Base.establish_connection(db_config_admin) |
| # Activate the gem you are reporting the issue against. | |
| gem 'activerecord', '4.2.6' | |
| require 'active_record' | |
| require 'minitest/autorun' | |
| require 'logger' | |
| $logger = Logger.new(STDOUT) | |
| # This connection will do for database-independent bug reports. | |
| ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') |