Skip to content

Instantly share code, notes, and snippets.

View brianr's full-sized avatar

Brian Rue brianr

View GitHub Profile
@brianr
brianr / gist:58899467f58b80eee1eb
Created July 1, 2015 17:59
rollbar.js checkIgnore to ignore all "Script error" uncaught errors
_rollbarConfig = {
accessToken: 'your token',
captureUncaught: true,
payload: {
environment: 'production',
},
checkIgnore: function(isUncaught, args, payload) {
if (isUncaught && args[0] && args[0].indexOf('Script error') === 0) {
// ignore
return true;
@brianr
brianr / gist:8360549
Created January 10, 2014 19:10
rollbar.js - ignore errors that aren't from a given domain (using rollbar.js version 0.10.8)
_rollbarConfig = {
"server.environment": "production",
// any other existing config...
checkIgnore: function(errMsg, file, line, col, err) {
// this function is called for all uncaught errors
// if it returns true, the error will be ignored
// instead of being reported to Rollbar.
if (file && !file.match(/^https?:\/\/www\.mycompany\.com/)) {
// has a filename, but filename (url) is not on www.mycompany.com.
@brianr
brianr / tos-2017-03-06.diff
Created March 6, 2017 23:03
diff of Rollbar Terms of Service changes for 3/6/17
224,225c224,225
< 221 Main St Suite 780<br>
< San Francisco, CA 94105<br>
---
> 51 Federal St Ste 401<br>
> San Francisco, CA 94107<br>
373,374c373,374
< These Services are operated and provided by Rollbar Inc., a Delaware corporation, 221 Main Street,
< Suite 780, San Francisco, CA 94105. If you have any questions about these Terms, please <a
---
@brianr
brianr / v4.diff
Created April 27, 2016 00:05
Rollbar Terms of Service - Diff of 12/15/2014 revision vs. 4/16/2016
154c154
< These Services are operated and provided by Rollbar Inc., a Delaware corporation, 414 Brannan St, San Francisco, CA 94107. If you have any questions about these Terms, please <a href="${request.route_url('about/contact')}">contact us</a>.
---
> These Services are operated and provided by Rollbar Inc., a Delaware corporation, 221 Main Street, Suite 780, San Francisco, CA 94105. If you have any questions about these Terms, please <a href="${request.route_url('about/contact')}">contact us</a>.
@brianr
brianr / hi.rb
Last active March 30, 2016 21:36
basic Rollbar usage with sinatra
require 'sinatra'
require 'rollbar'
configure do
Rollbar.configure do |config|
config.access_token = 'aaaabbbbccccddddeeeeffff00001111'
config.environment = 'sinatra-test'
end
end
@brianr
brianr / Gemfile
Created October 30, 2013 21:16
Example of adding `report_message_with_person` to the Rollbar class so you can send person data (which will be indexed) with a `report_message`-like call. To use, put both files in a directory somewhere and: bundle install bundle exec ruby report_message_with_person.rb
source 'https://rubygems.org'
gem 'rollbar'
function runTest() {
console.log("making ajax call");
$.ajax({
url: "/failing"
}).fail(function(result) {
console.log("in fail");
console.log("_rollbar:", _rollbar);
return _rollbar.push('TEST', function() {
console.log("in callback");
return alert('TEST');
{
"event_name": "reactivated_item",
"data": {
"item": {
"status": 1,
"environment": "development",
"counter": 766,
"hash": "8a2dca9cc02fb27deee9dda24acb15532ee73dce",
"integrations_data": {},
"title": "NameError: undefined local variable or method `bar' for #<HomeController:0x00000103ce4380>",
@brianr
brianr / test.html
Created April 1, 2013 22:48
bare bones rollbar test page
<html>
<head>
<script>
var _rollbarParams = {"server.environment": "production"};
_rollbarParams["notifier.snippet_version"] = "2"; var _rollbar=["client-side-token-here", _rollbarParams]; var _ratchet=_rollbar;
(function(w,d){w.onerror=function(e,u,l){_rollbar.push({_t:'uncaught',e:e,u:u,l:l});};var i=function(){var s=d.createElement("script");var
f=d.getElementsByTagName("script")[0];s.src="//d37gvrvc0wt4s1.cloudfront.net/js/1/rollbar.min.js";s.async=!0;
f.parentNode.insertBefore(s,f);};if(w.addEventListener){w.addEventListener("load",i,!1);}else{w.attachEvent("onload",i);}})(window,document);
</script>
diff --git a/rollbar.php b/rollbar.php
index d36a09c..d392102 100644
--- a/rollbar.php
+++ b/rollbar.php
@@ -663,6 +663,9 @@ class RollbarNotifier {
$url = $this->base_api_url . $action . '/';
$ch = curl_init();
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
+ // add the following only if on php 5.3.2 or higher