Skip to content

Instantly share code, notes, and snippets.

Pankaj Pandey pankajp

Block or report user

Report or block pankajp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pankajp
pankajp / caching_mod.py
Created Dec 8, 2018
Python module level property and cached property decorator
View caching_mod.py
from mod_prop import mod_property, cached_mod_property
@mod_property
def my_prop():
print('my_prop called')
return 42
@cached_mod_property
def my_cached_prop():
@pankajp
pankajp / serve_http.py
Last active Aug 27, 2019
Simple Python HTTP Server with multi-threading and partial-content support
View serve_http.py
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
View backend_fogbugz.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
@pankajp
pankajp / qtextinsert.py
Created Jul 1, 2013
The performance effect of text overflow in a QPlainTextEdit with setMaximumBlockCount set.
View qtextinsert.py
from pyface.qt import QtGui, QtCore
import time
import pandas
import numpy
from matplotlib import pyplot as plt
a = QtGui.QApplication.instance() or QtGui.QApplication([])
w = QtGui.QPlainTextEdit()
w.setMinimumSize(600, 400)
@pankajp
pankajp / traits_tree_editor_icon_change.py
Created Dec 5, 2012
Dynamically change the icon of a tree node in Traits TreeEditor
View traits_tree_editor_icon_change.py
from traits.api import *
from traitsui.api import *
global_count = 0
class TNode(TreeNodeObject):
count = 0
files = List
label = Str
something = Int
@pankajp
pankajp / cssify.js
Created Oct 22, 2012 — forked from Dither/cssify.js
Convert XPath to CSS selector
View cssify.js
// JavaScript function for converting simple XPath to CSS selector.
// Ported by Dither from [cssify](https://github.com/santiycr/cssify)
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')`
var sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)",
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)",
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*"
};
You can’t perform that action at this time.