捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。
window.onerror 讲接收3个参数:
msg
:错误描述,比如:a is not definedurl
:出错脚本所在的urllineNumber
:出错脚本的行数
本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。
捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。
window.onerror 讲接收3个参数:
msg
:错误描述,比如:a is not definedurl
:出错脚本所在的urllineNumber
:出错脚本的行数本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。
/** | |
* Angular needs to send the Rails CSRF token with each post request. | |
* | |
* Here we get the token from the meta tags (make sure <%= csrf_meta_tags %> | |
* is present in your layout.) | |
*/ | |
angular.module('myapp',[]). | |
// configure our http requests to include the Rails CSRF token | |
config(["$httpProvider", function(p) { | |
var m = document.getElementsByTagName('meta'); |
unicorn.rb | |
----------------------------------- | |
application = "jarvis" | |
remote_user = "vagrant" | |
env = ENV["RAILS_ENV"] || "development" | |
RAILS_ROOT = File.join("/home", remote_user, application) | |
worker_processes 8 | |
timeout 30 |
after "deploy:update", "deploy:cleanup" | |
after "deploy:update", "foreman:export" | |
after "deploy:symlink", "update_haproxy_config_symlink" | |
namespace :deploy do | |
task :stop do | |
run "sudo stop goliath_app" | |
end | |
task :start do | |
run "sudo start goliath_app" |
#!/usr/bin/env ruby | |
# gem install grape --pre | |
# http://localhost:9000/hello.json | |
# => {"hello":"world"} | |
$:<< '../lib' << 'lib' | |
require 'goliath' |
require 'rubygems' | |
require 'redis' | |
require 'redis/distributed' | |
r = Redis::Distributed.new %w[redis://host1:6379 redis://host2:6379] | |
# show node for key "foo" | |
p r.node_for("foo") | |
# set the value of "foo" |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
You have your Rails Apps with specific Gemsets in RVM.
The following commands creates a wrapped unicorn_rails bin. Be sure to replace the variables and that you have unicorn in your bundle.
rvmsudo rvm wrapper [RUBY VERSION]@[GEMSET] [GEMSET] unicorn_rails
Now you have a /usr/local/rvm/bin/[GEMSET]_unicorn_rails I will refer to [GEMSET]_unicorn_rails as [WRAPPED_NAME]
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: jboss | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/Stop JBoss AS v7.0.0 | |
### END INIT INFO | |
# |