This gist shows how you could use apartment with searchkick, including a rake task that reindex all models/tenants.
This gist is used in this blog post: http://tiagoamaro.com.br/2014/12/11/multi-tenancy-with-searchkick/
# The ChatGptService class provides an easy way to integrate with the OpenAI ChatGPT API. | |
# It allows you to send and receive messages in a conversation thread, and reset the thread | |
# if necessary. | |
# | |
# Example usage: | |
# chat_gpt_service = ChatGptService.new(BEARER_TOKEN) | |
# response = chat_gpt_service.chat("Hello, how are you?") | |
# puts response | |
# # => {"message"=> | |
# # {"id"=>"8e78691a-1fde-4bd5-ad68-46b23ea65d8f", |
This gist shows how you could use apartment with searchkick, including a rake task that reindex all models/tenants.
This gist is used in this blog post: http://tiagoamaro.com.br/2014/12/11/multi-tenancy-with-searchkick/
# As used with CanCan and Devise | |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
include ErrorResponseActions | |
rescue_from CanCan::AccessDenied, :with => :authorization_error | |
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found | |
before_filter :authenticate! |
def load_assets | |
@stylesheets, @javascripts = [], [] | |
[controller_path, "#{controller_path}/#{action_name}"].each do |i| | |
@stylesheets << "pages/#{i}" if File.exists? "#{Rails.root}/app/assets/stylesheets/pages/#{i}.css.scss" | |
@javascripts << "pages/#{i}" if File.exists? "#{Rails.root}/app/assets/javascripts/pages/#{i}.js.coffee" | |
end | |
end |
A Dashing widget for displaying the number of current visitors (in real time) to your website, as reported by Google Analytics.
This widget is a fork of https://gist.github.com/mtowers/5986576
# This is done on Rails 3.2.2 | |
# Make sure to define your signup route in routes.rb as a POST | |
# Mailchimp | |
gem 'gibbon' | |
gem 'thin' |
This is a post by Joel Spolsky. The original post is linked at the bottom.
This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.
The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju
validate :check_dimensions | |
def check_dimensions | |
temp_file = background_image.queued_for_write[:original] | |
unless temp_file.nil? | |
dimensions = Paperclip::Geometry.from_file(temp_file) | |
width = dimensions.width | |
height = dimensions.height | |
if width < 800 && height < 600 |