Instantly share code, notes, and snippets.

View test.html
<!doctype html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prototype/1.6.0/prototype.min.js"></script>
<script>
(function() {
var originalStringify = JSON.stringify;
JSON.stringify = function stringify() {
var old = Array.prototype.toJSON;
delete Array.prototype.toJSON;
try {
return originalStringify.apply(this, arguments);
View foo.py
def make_failing_function(exception, function_name, filename):
code = compile('def f(): raise exception', filename, 'exec')
namespace = {'exception': exception}
eval(code, namespace)
code = namespace['f'].__code__
CodeType = type(code)
namespace['f'].__code__ = CodeType(
code.co_argcount,
code.co_nlocals,
View input.json
{
"ip": "192.168.1.1",
"message": "Hello peter@gmail.com. You signed up with card 1234-1234-1234-1234. Your home folder is C:\\Users\\peter. Look at our compliance from 127.0.0.1",
"extra": {
"foo": 42,
"bar": true
}
}
View aha.rs
{
"event_id": "cdbe646b-de0e-4f85-bdc5-2703bc517bdf"
}
->
Event {
id: Annotated {
value: Maybe::Valid(Uuid("cdbe646b-de0e-4f85-bdc5-2703bc517bdf")),
metadata: MetaData { errors: vec![] },
View aha.rs
pub fn add_scope_processor<F, B>(&mut self, f: F)
where
F: Fn(&mut Event) + Sync + Send,
Box<F>: im::shared::Shared<Box<Fn(&mut Event) + Sync + Send>>,
{
self.scope_processors = self.scope_processors.push_back(Box::new(f));
}
View hmm.rs
pub fn add_scope_processor<F>(&mut self, f: Box<F>)
where
F: Fn(&mut Event) + Sync + Send + ?Sized,
Box<F>: im::shared::Shared<Box<Fn(&mut Event) + Sync + Send>>,
{
self.scope_processors = self.scope_processors.push_back(f);
}
View gist:08420503db1b40aef2611ff447013b38
#[derive(Clone)]
pub struct Scope {
pub(crate) fingerprint: Option<Arc<Vec<Cow<'static, str>>>>,
pub(crate) transaction: Option<Arc<String>>,
pub(crate) breadcrumbs: im::Vector<Breadcrumb>,
pub(crate) user: Option<Arc<User>>,
pub(crate) extra: im::HashMap<String, Value>,
pub(crate) tags: im::HashMap<String, String>,
pub(crate) contexts: im::HashMap<String, Option<Context>>,
pub(crate) scope_processors: im::Vector<Box<FnMut(&mut Event) + Sync + Send>>,
View broken.rs
use std::fmt::Debug;
trait Foo: Debug + 'static {
// either remove this method
fn debug(&self) -> String where Self: Sized {
format!("{:?}", self)
}
}
impl Foo {
View asfail.rs
/// Helper trait to downcast a response error into a fail.
pub trait ResponseErrorAsFail {
/// Returns the response error as fail.
fn as_fail(&self) -> &Fail;
/// Returns the response error as mut fail.
fn as_mut_fail(&mut self) -> &mut Fail;
}
#[doc(hidden)]
impl<T: ResponseError> ResponseErrorAsFail for T {
View gist:241d44daa818c3417448805bc70e8bee
sentry-cli-Darwin-x86_64`thread_local::thread_id::get::hc2a84d0e0859fd2f:
-> 0x1005d384b <+123>: movdqa (%rax), %xmm0
0x1005d384f <+127>: movq $0x1, (%rax)
0x1005d3856 <+134>: movq %rcx, 0x8(%rax)
0x1005d385a <+138>: movdqa %xmm0, -0x20(%rbp)
Target 0: (sentry-cli-Darwin-x86_64) stopped.
(lldb) bt
* thread #2, stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x00000001005d384b sentry-cli-Darwin-x86_64`thread_local::thread_id::get::hc2a84d0e0859fd2f + 123
frame #1: 0x00000001005763d6 sentry-cli-Darwin-x86_64`regex::re_unicode::Regex::captures::hd2ce31a6cd7fdbc7 + 70