Skip to content

Instantly share code, notes, and snippets.

View fabioz's full-sized avatar

Fabio Zadrozny fabioz

View GitHub Profile
# License: LGPL
#
# Copyright: Brainwy Software
def overrides(method):
'''
This is just an 'annotation' method to say that some method is overridden.
It also checks that the method name is the same.
@fabioz
fabioz / pyedit_custom_surround_with.py
Last active August 29, 2015 14:22
Example command to create a 'surround with' action in PyDev
if False:
from org.python.pydev.editor import PyEdit #@UnresolvedImport
cmd = 'command string'
editor = PyEdit
systemGlobals = {}
if cmd == 'onCreateActions':
assert editor is not None
MySurroundAction = systemGlobals.get('MySurroundAction')
@fabioz
fabioz / check_debugger_performance.py
Created September 11, 2014 13:07
Script to check debugger performance
'''
Script to check debugger speed.
2 breakpoints should be added (at comments below), then
run to initial breakpoint (first stop), then continue
execution to the second breakpoint and see the total time.
'''
import time
scope_to_color_name: {
#All types of strings map to the string color
doubleQuotedString: string,
multiLineContext2: string,
multiLineContext1: string,
singleLineContext: string,
}
@fabioz
fabioz / gist:59b06c519f505d37fcfb
Last active August 29, 2015 14:03
Custom Painter
/**
* @author: Fabio Zadrozny
* @licenes: EPL
**/
package com.brainwy.liclipse.theme.e4;
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.swt.dom.ControlElement;
@fabioz
fabioz / profiling.py
Last active November 15, 2019 03:22
Profile method decorator in Python showing a graphical (.svg) representation (as well as a text-based representation) as the output.
import pstats
import sys
import subprocess
import os
try:
import cProfile as profile
except ImportError:
import profile
@fabioz
fabioz / decorators.py
Created June 20, 2011 17:00
Overrides/implements decorators
def overrides(method):
def wrapper(func):
if func.__name__ != method.__name__:
msg = "Wrong @override: %r expected, but overwriting %r."
msg = msg % (func.__name__, method.__name__)
raise AssertionError(msg)
if func.__doc__ is None:
func.__doc__ = method.__doc__