Example usage:
old_accounts = Account.where("created_at < ?", 1.month.ago)
old_abandoned_trials = AbandonedTrialQuery.new(old_accounts)
old_abandoned_trials.find_each do |account|
account.send_offer_for_support
ref: http://nathanhoad.net/deploy-from-a-git-tag-with-capistrano | |
Deploy from a Git tag with Capistrano | |
Are you using Capistrano and Git and want to easily deploy from Git tags? It couldn't be simpler | |
Using Git, tag a new release: | |
git tag -a 09.10.02.01 -m "Tagging a release" | |
You can use git tag to list your tags: |
require 'fileutils' | |
# Warning: The following deploy task will completely overwrite whatever is currently deployed to Heroku. | |
# The deploy branch is rebased onto master, so the push needs to be forced. | |
desc "Deploy app to Heroku after precompiling assets" | |
task :deploy do | |
deploy_branch = 'heroku' | |
remote = 'heroku' | |
deploy_repo_dir = "tmp/heroku_deploy" |
module StaticMapHelper | |
def static_map_for(location, options = {}) | |
params = { | |
:center => [location.lat, location.lng].join(","), | |
:zoom => 15, | |
:size => "300x300", | |
:markers => [location.lat, location.lng].join(","), | |
:sensor => true | |
}.merge(options) |
module.exports = function(mediator) { | |
var mongo = require('mongodb'), | |
Server = mongo.Server, | |
Db = mongo.Db, | |
ReplSet = mongo.ReplSet, | |
config = require('../../config'), | |
replSetName = config.mongo.rsname, | |
servers = config.mongo.servers, | |
dbName = config.mongo.dbname; |
# based on http://uberblo.gs/2011/06/high-performance-url-shortening-with-redis-backed-nginx | |
# using code from http://stackoverflow.com/questions/3554315/lua-base-converter | |
# "database scheme" | |
# database 0: id ~> url | |
# database 1: id ~> hits | |
# database 2: id ~> [{referer|user_agent}] | |
# database 3: id ~> hits (when id is not found) | |
# database 4: id ~> [{referer|user_agent}] (when id is not found) | |
# database 5: key "count" storing the number of shortened urls; the id is generated by (this number + 1) converted to base 62 |
require 'tilt-mustache' | |
# Mustache Renderer | |
module Middleman::Renderers::Mustache | |
class << self | |
def registered(app) | |
# Mustache is not included in the default gems, | |
# but we'll support it if available. | |
begin | |
__git_repo () { | |
local g="$(__gitdir)" | |
local repo_dir="" | |
if [ -n "$g" ]; then | |
if [ ! ".git" == "$g" ]; then | |
git_dir=`dirname $g` | |
repo_dir=`basename $git_dir` | |
printf " $repo_dir" | |
fi |
Are still a nightmare to get tested, etc.
To share sessions across subdomains you need to set the session options during the request so you know what domain you're sharing across. This means we still need to do it with a before_filter, or something similar. It looks like you should be able to set :domain => true
in config/initializers/session_store.rb
to do this instead but Devise does not support it yet as far as I can see.
Here I'm using subdomains with a custom url_for
extension which means from "http://www.smackaho.st" root_path
would be "/" while from "http://admin.smackaho.st" root_path
would be "http://www.smackaho.st/".
In cucumber this is forced to always qualify the full URL with the subdomain. It also rewrites the port in/out as neccessary to cope with Capybara's server using an alternate port (used by Selenium for javascript testing etc). The project I'm on is still using web_steps (sigh) so I had to touch the "should be on" step definition to cope with