Skip to content

Instantly share code, notes, and snippets.

function reset_colors(map) {
var layer = map.featureLayer,
geoJson = layer.getGeoJSON(),
features = geoJson.features;
for (var i = 0; i < features.length; i++) {
features[i].properties['marker-color'] = "#0F86BD";
}
layer.setGeoJSON(geoJson);
}
// get text for element without children text
var article_title_in_cn = $this.clone().children().remove().end().text().trim();
Article.joins(:tags).where(tags: {id: tag_ids_arr}).order("articles.updated_at DESC").pluck(:id).uniq
= I18n.backend.translate("zh-TW", "tags.#{tag_of_like_article.tag_type}")
a.sort # sort by asc
a.sort { |x,y| y <=> x } # sort by desc
#create capistrano task to run rake task of rails
# add below code to deploy.rb
desc "recreate version of all images."
task :recreate_version_of_images do
on roles(:app) do
within "#{current_path}" do
with rails_env: :production do
execute :rake, "images:recreate_version"
end
end
Image.where("image is not ?", nil).each do |image| image.image.recreate_versions! if image.image? end
params.require(:article).permit(:title, :content, :description, :images_attributes => [:title, :image])
# return boolean but not MatchData
!!website.match(Regexp.new(sites))
TODO List
2014-10-12 13:04:37 ----------------------------------------
[_] 50% About vimoutliner
[X] Learn vimoutliner
[_] Content code issue of vimoutliner when use otl2html.py
NEXT ACTIONS
[_] 16%Lenrn rails
[X] Try swaggerui gem
[_] Learn docker-http://blog.gemnasium.com/post/65599561888/rails-meets-docker
[_] Learn chef http://learn.getchef.com/