Skip to content

Instantly share code, notes, and snippets.

View andreyvit's full-sized avatar

Andrey Tarantsov andreyvit

View GitHub Profile
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
# 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
dsfsdfdsfds
import module
def handle():
...
def main():
try:
module.test()
except:
handle()
# 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:
# 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 += '/'
# 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:
#
<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);
}
package com.instantiations.eclipse.analisys.indexer.storage.diskmapped;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import com.instantiations.eclipse.analisys.indexer.storage.db.PagedMemoryException;
import com.instantiations.eclipse.analisys.indexer.storage.reusable.filesystem.FileObject;
@andreyvit
andreyvit / UIPickerView_SelectionBarLabelSupport.h
Created October 23, 2009 01:08
UIPickerView category that allows to easily recreate the look and feel of UIDatePicker labeled components (HIG calls them “translucent bar labels”)
// UIPickerView_SelectionBarLabelSupport.h
//
// This file adds a new API to UIPickerView that allows to easily recreate
// the look and feel of UIDatePicker labeled components.
//
// Copyright (c) 2009, Andrey Tarantsov <andreyvit@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.