pyvenv-3.3 venvdir
venvdir/bin/python -c 'import sys; print(sys.path)'
# This should print the venvdir in sys.path.
class DocumentUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
# Store on Amazon S3 using Fog | |
storage :fog | |
# Directory where uploaded files will be stored. | |
def store_dir | |
"documents/#{model.id}" | |
end |
# Simple Recommendation Engine in Ruby | |
# Visit: http://otobrglez.opalab.com | |
# Author: Oto Brglez <otobrglez@gmail.com> | |
class Book < Struct.new(:title) | |
def words | |
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort | |
end |
## This script can be used to detect simple order dependencies if one of tests is failing when some other test(or tests, independently) is being run before it. | |
## Script will not give reliable results if the dependency is complex - e.g. two specific tests must be run before for affected one to fail. | |
## Script will refine results with each rspec run: more runs will result smaller UNSAFE lists. Files from previous script runs are used too | |
## Ensure that you have config.order = 'random' in RSpec.configure block . | |
## Running rspec with different seeds to collect data | |
RSPEC_RUN_COUNT = 5 #set to 0 to analyze already existing rspec_*.txt files | |
RSPEC_RUN_COUNT.times do |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws-sdk' | |
class S3FolderUpload | |
attr_reader :folder_path, :total_files, :s3_bucket | |
attr_accessor :files |
namespace :optimization do | |
desc "Provide DB vacuum for production environment" | |
task :vacuum => :environment do | |
begin | |
tables = ActiveRecord::Base.connection.tables | |
tables.each do |table| | |
ActiveRecord::Base.connection.execute("VACUUM FULL ANALYZE #{table};") | |
end | |
rescue Exception => exc | |
Rails.logger.error("Database VACUUM error: #{exc.message}") |
In this episode we're going to be adding realtime notifications into your app using ActionCable. We've talked about notifications a few times in the past and we used AJAX polling for that. 95% of the time, polling is the solution that would be recommended for it.
But if you're looking for a good introduction into ActionCable then this is a decent one because we're only really using it for one way from the server side to the client side.
So to get started we're starting with an app that has Bootstrap installed and then we created a Main controller with an index view which is where we will list our Notifications as for this example.
Before we generate our channels let's install a few things
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/