This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from random import randint | |
from time import time | |
DATA = [ | |
(i, randint(5,30), randint(5,30), randint(30,35), randint(1,5)) \ | |
for i in xrange(1, 401) | |
] | |
def mapValues(group): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#move vertices as rod goes over it | |
import maya.OpenMaya as om | |
import maya.cmds as cmds | |
import math as m | |
class vertexInfo(object): | |
def __init__(self): | |
self.verX = [] | |
self.verY = [] | |
self.verZ = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Cache the generic relation field of all the objects | |
in the queryset, using larger bulk queries ahead of time. | |
Improved from original by Daniel Roseman: | |
http://blog.roseman.org.uk/2010/02/22/django-patterns-part-4-forwards-generic-relations/ | |
''' | |
def cache_generics(queryset): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Dependencies: | |
pip install tabulate simplejson ujson yajl msgpack | |
""" | |
from timeit import timeit | |
from tabulate import tabulate | |
setup = '''d = { | |
'words': """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4 import QtCore, QtGui | |
class Window(QtGui.QDialog): | |
def __init__(self): | |
super(Window, self).__init__() | |
self.resize(200,100) | |
self._new_slider_min = .1 | |
self._new_slider_max = .9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getShellFaces(poly, asString=False): | |
shells = set() | |
faces = set() | |
total = cmds.polyEvaluate(poly, s=True) | |
for f in xrange(cmds.polyEvaluate(poly, f=True)): | |
if len(shells) >= total: | |
break | |
if f in faces: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4 import QtCore, QtGui | |
class AnimatedDialog(QtGui.QDialog): | |
def __init__(self, parent=None): | |
super(AnimatedDialog, self).__init__(parent) | |
self.text = QtGui.QLineEdit(self) | |
self.text.move(20,20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4 import QtGui, QtCore | |
class RenderManagement(QtGui.QWidget): | |
def __init__(self): | |
super(RenderManagement, self).__init__() | |
self.v_layout = QtGui.QVBoxLayout(self) | |
# Create 5 dynamic items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtCore import * | |
from PyQt4.QtGui import * | |
class ListOrderView(QListView): | |
itemMoved = pyqtSignal(int, int, QStandardItem) | |
def __init__(self, parent=None): | |
super(ListOrderView, self).__init__(parent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
setup.py | |
py2app setup script for creating a semi-standalone .app | |
around a Maya API based PyQt4 application. | |
Only bundled PyQt4 with the app, and references the Maya install | |
location for the python environment. | |
Allows for a portable GUI application that does not require |