Version: 1.9.7
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
require 'fileutils' | |
desc "Create nondigest versions of all ckeditor digest assets" | |
task "assets:precompile" => :environment do | |
fingerprint = /\-([0-9a-f]{32})\./ | |
for file in Dir["public/assets/ckeditor/**/*"] | |
# Skip file unless it has a fingerprint | |
next unless file =~ fingerprint | |
# Get filename of this file without the digest |
以下只适合 v3.5.0 即以前的版本。v3.6.0 以后,对选项增加了 shellescape 减少了命令行注入的风险。
ImageMagick 的 composite
命令可以合成图片,但是一次只能合成两张。如果需要合成多张图片,得用 convert
命令和 -composite
选项。MiniMagick 的push
方法,可添加选项和参数(就像在命令行操作一样)。下是一个合成多张图片的 CarrierWave 的 process 示例。
def composite_images
manipulate! do |img|
img.combine_options(:convert) do |c|
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
There are many (old) clients available:
The Google Analytics API is at v3 (at time of writing).
This example uses Google's Ruby API client to access Analytics. Use https://github.com/google/google-api-ruby-client (Google supported).
################################# | |
# | |
# 本清单基于 ubuntu 12.04, | |
# | |
# 只是一个清单,不是一个可以安全执行的脚本 | |
# | |
################################# | |
# create a linode,login as root, and create a common user for all the tasks | |
ssh root@the_ip_of_this_linode |
set :stage, 'production' | |
set :shared_children, shared_children << 'tmp/sockets' | |
puma_sock = "unix://#{shared_path}/sockets/puma.sock" | |
puma_control = "unix://#{shared_path}/sockets/pumactl.sock" | |
puma_state = "#{shared_path}/sockets/puma.state" | |
puma_log = "#{shared_path}/log/puma-#{stage}.log" | |
namespace :deploy do | |
desc "Start the application" |