Skip to content

Instantly share code, notes, and snippets.

View OmniZ3D's full-sized avatar

Jason Barnidge OmniZ3D

View GitHub Profile
@OmniZ3D
OmniZ3D / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bennage
bennage / startScreen.js
Last active December 10, 2015 02:58
basic logic for a start screen (the main menu) of my game
// `input` will be defined elsewhere, it's a means
// for us to capture the state of input from the player
var startScreen = (function(input) {
// the red component of rgb
var hue = 0;
// are we moving toward red or black?
var direction = 1;
var transitioning = false;
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/python");</script>
from copy import deepcopy
def invert(X):
"""
Invert a matrix X according to gauss-jordan elimination
In gauss-jordan elimination, we perform basic row operations to turn a matrix into
row-echelon form. If we concatenate an identity matrix to our input
matrix during this process, we will turn the identity matrix into our inverse.
X - input list of lists where each list is a matrix row
output - inverse of X
"""
@OmniZ3D
OmniZ3D / getSelectedOrder.py
Created June 27, 2013 10:00
getSelectedOrder (MotionBuilder) snippet function via pyfbsdk FBGetSelectedModels
from pyfbsdk import *
def getSelectedOrder():
# selectionOrder selection order
# Get the current selection
lModelList = FBModelList()
pParent = None
pSelected = True
pSortSelectedOrder = True
FBGetSelectedModels( lModelList, pParent, pSelected, pSortSelectedOrder )
@justinfx
justinfx / button_shift_click.py
Created December 3, 2012 18:59
A QPushButton that checks for the shift key modifier
"""
Record various key press states from a custom QPushButton
"""
from PyQt4 import QtGui, QtCore
class Button(QtGui.QPushButton):
def __init__(self, *args, **kwargs):
@freekrai
freekrai / DropboxSync.py
Created December 1, 2012 16:34 — forked from wrenoud/DropboxSync.py
DropboxSync
import os
import sys
import pickle
import console
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
class dropbox_state:
@JokerMartini
JokerMartini / Toggle GroupBox Collapse | .py
Created November 4, 2015 14:44
Python Pyside: Toggle the expansion of a groupbox in pyside using the groupbox.
import sys
from PySide import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self,):
super(Example, self).__init__()
self.initUI()
@petfactory
petfactory / MayaPySideTablayout.py
Created April 17, 2013 12:33
Testing out PySide in Maya 2014. Creating a simple Tab layout with some buttons. Not sure if this is the "proper" way to do it. Copied some stuff from a Nuke PySide test I did a while back. Seems to work though. Feedback are of course welcome.
from PySide import QtCore, QtGui
from shiboken import wrapInstance
import maya.OpenMayaUI as apiUI
import sys
def getMayaWindow():
"""
Get the main Maya window as a QtGui.QMainWindow instance
@return: QtGui.QMainWindow instance of the top level Maya windows
"""
@OmniZ3D
OmniZ3D / FBX Wrapper.py
Created October 3, 2017 22:16 — forked from theodox/FBX Wrapper.py
FBXWrapper
'''
FBXWrapper
This module provides a python wrapper for every method exposed in the FBX plugin.
The arguments for the calls are the same as for the equivalent mel calls, however they can be passed with typical
python syntax, which is translated to mel-style flags and arguments under the hood. The actual flags and arguments
are documented here:
usage: