Get it from the App Store.
In XCode's Preferences > Downloads you can install command line tools.
class GenerateImageThumbnailsJob < Struct.new(:photo_id) | |
def perform | |
photo = Photo.find(photo_id) | |
photo.medium_image = photo.image.thumb('940x600') | |
photo.large_image = photo.image.thumb('450x') | |
photo.small_image = photo.image.thumb('172x167#c') | |
photo.save | |
end |
## If you are using under a rails project, | |
## I recommend to put this script onto config/initializer instead of applying the patch | |
module Compass::SassExtensions::Functions::GradientSupport | |
class ColorStop < Sass::Script::Literal | |
def initialize(color, stop = nil) | |
self.options = {} | |
if color.is_a?(Sass::Script::String) && color.value == 'transparent' |
$ heroku addons:add elasticsearch:test | |
-----> Adding elasticsearch:test to bonsai-search... done, v51 (free) | |
$ heroku config | grep ELASTICSEARCH_URL | |
ELASTICSEARCH_URL => http://index.bonsai.io/pw4mw3d5y1rql88i44eo | |
$ curl 'http://index.bonsai.io/pw4mw3d5y1rql88i44eo/test?pretty=true' -d '{"test":"hello world"}' | |
{ | |
"ok":true, | |
"_index":"pw4mw3d5y1rql88i44eo", |
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
__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 |
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 | |
# 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 |
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; |
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) |