我正在开发一个针对Firefox,Safari,Chrome的浏览器插件,它将拦截页面上的数据,针对正则表达式运行它,然后如果它匹配 - 重新格式化它.我有这个工作在页面加载使用:
var meth = {
replaceInElement : function(element, find, replace) {
// iterate over child nodes and replace
},
run : function(evt){
// doc is the document that triggered "run" event
if (!(evt.target.nodeName === "#document")) { return; }
var doc = evt.target; // document that triggered "onload" event
if (!(doc instanceof HTMLDocument)) { return; }
if (!doc.location) { return; }
// perform substitutions on the loaded document
var find = /regex/gi
meth.replaceInElement(doc.body, find, function(match) {
var new_content;
//do …Run Code Online (Sandbox Code Playgroud) javascript xmlhttprequest firefox-addon addeventlistener google-chrome-extension
我试图在RHEL上安装snorby.它要求红宝石,我试过,现在我卡住了rmagick错误.
请帮忙.
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable …Run Code Online (Sandbox Code Playgroud) 我想问一下使用Ruby的PI和cos的类型.写这些类型的惯例是什么?
我可以这样写:Math::sin,Math::PI或者Math.sin,Math.PI?
什么是内容缓存(比如这个插件:http://blog.codahale.com/2006/04/10/content-only-caching-for-rails/)vs Rails内置的页面/动作/片段缓存?
我想在我的Rails应用程序上进行缓存,但我不太清楚要使用哪种类型.我的应用程序主要包含每页上的动态,用户特定数据.缓存甚至可能吗?
你可以在红宝石中:
class ApplicationController < ActionController::Base
before_filter :require_login
end
Run Code Online (Sandbox Code Playgroud)
我只是想知道什么是before_filter?它是ActionController :: Base的一个方法吗?
如果我创建ApplicationController的对象会发生什么?before_filter方法会运行吗?
谢谢!
我很好奇是否有人知道如何在Flash Builder 4中获取VI/VIM键绑定.我知道我可以直接在VIM中编辑文件,但是因为我刚刚开始使用Flex - 我更愿意使用IDE,直到我了解我的情况.
我在OSX Snow Leopard上运行Flash Builder 4.
任何帮助将不胜感激.
我正在使用devise 2.1.0 for rails app 3.2.3.这是我做的:
Add gem 'devise' to Gemfile and run bundle
Run rails g devise:install
Run rails g devise User
Setup db by running rake db:migrate
Run Code Online (Sandbox Code Playgroud)
application.html.erb是这样的:
<%if user_signed_in? %>
Welcome <%= current_user.email%>
<%= link_to "Sign out", destroy_user_session_path%>
<% else %>
<%= link_to "Sign up", new_user_registration_path %> or
<%= link_to "Sign in", new_user_session_path %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
登录和注册工作正常,但当我单击退出时,我收到一条错误消息:
路由错误
没有路由匹配[GET]"/ users/sign_out"尝试运行rake路由以获取有关可用路由的更多信息.
这是rake路线的输出:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) …Run Code Online (Sandbox Code Playgroud) ruby ×4
apache-flex ×1
caching ×1
devise ×1
imagemagick ×1
javascript ×1
rake ×1
rmagick ×1
vim ×1