Skip to content

Instantly share code, notes, and snippets.

View andreyvit's full-sized avatar

Andrey Tarantsov andreyvit

View GitHub Profile
<html>
<head>
<script src="http://crashkitapp.appspot.com/static/javascript/crashkit-javascript.js?test/js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="http://localhost:5005/static/javascript/crashkit-javascript.js?test/js" type="text/javascript" charset="utf-8"></script> -->
<script src="crashkit-javascript-sample.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
function xxx(a) {
yyy(a, a, a);
}
# Copyright (c) 2009 Andrey Tarantsov, YourSway LLC (crashkit client)
# Copyright (c) 2006 Bob Ippolito (simplejson)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# This code is a part of CrashKit, a web-based crash collection and analysis software
# (http://crashkitapp.appspot.com). Please consider it to be in public domain.
def get_package_name(frame):
shortest_package = frame.f_globals.get('__name__')
if shortest_package is None: # afaik this only happens while importing a module
for folder in sys.path:
folder = os.path.abspath(folder).replace('\\', '/')
if not folder.endswith('/'):
folder += '/'
# This code is a part of CrashKit, a web-based crash collection and analysis software
# (http://crashkitapp.appspot.com). Please consider it to be in public domain.
def get_class_name(frame):
"""Guesses a class name to show in a stack trace for the given frame,
based on the attributes of the first argument of the frame's function."""
code = frame.f_code
fname = code.co_name
if code.co_argcount > 0:
import module
def handle():
...
def main():
try:
module.test()
except:
handle()
dsfsdfdsfds
# min(alchogol to understand this func), vodka, cognac or “Gay Milker” kefir only
def apply_deletion range
return self if range.start >= self.end # -500 ml
len_diff = [self.length, range.length, self.end - range.start, range.end - self.start].min # 1000 ml
new_start = [range.start - [0, len_diff].min, self.start].min # 300 ml
TimeRange.new(new_start, new_start + self.length - [0, len_diff].max) # 700 ml
# total: 1500 ml
end
import compiler
from compiler.ast import *
import pprint
from StringIO import StringIO
from tempfile import TemporaryFile
import re
#b = 1
#c = 2
#a = b+c
private void calculateSymbolOffsets() {
int start = 0;
int lastPercent = 0;
for (int i = 0; i < symbols.size(); i++) {
// int pc = (int) (100.0 * i / symbols.size());
// if (pc != lastPercent) {
// System.out.println("Calculating offsets: " + pc + "% done");
// lastPercent = pc;
@register.tag(name='e')
def parse_eval_tag(parser, token):
tag_name, code = token.contents.split(' ', 1)
return PythonEvalNode(code, escape=(lambda x:x))
@register.tag(name='ee')
def parse_eval_and_escape_tag(parser, token):
tag_name, code = token.contents.split(' ', 1)
return PythonEvalNode(code, escape=escape)