Skip to content

Instantly share code, notes, and snippets.

View jhoolmans's full-sized avatar

Jeroen Hoolmans jhoolmans

View GitHub Profile
module UsersHelper
#Returns the Gravatar for the given user.
def gravatar_for(user, options = { size: 50 })
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.email, class: "img-responsive")
end
@jhoolmans
jhoolmans / toggle_menubar_native.py
Created September 18, 2014 17:10
MAYA: Toggle MainWindow menubar to be native or not. Moves the menubar into the mainwindow on OSX. This may be useful while recording and scaling your window to fit a certain size.
import maya.OpenMayaUI as OMUI
from PySide import QtCore
from PySide import QtGui
from shiboken import wrapInstance
def maya_main_window():
mainWindowPtr = OMUI.MQtUtil.mainWindow()
return wrapInstance(long(mainWindowPtr), QtGui.QMainWindow)
@jhoolmans
jhoolmans / HierarchyLRA.mel
Created January 20, 2013 20:13
Toggle local rotation axis display on entire hierarchy
select -hi;
ToggleLocalRotationAxes;
@jhoolmans
jhoolmans / orientTipJointsToParent.mel
Last active December 11, 2015 09:39
Zeroes out all tip joints' orients axis.
// Orient tip joint to parent
{
proc string[] getChildren(string $nodes[])
{
return `listRelatives -f -c $nodes`;
}
proc int isTip(string $node)
{
if (size(getChildren({$node})) > 0)
@jhoolmans
jhoolmans / orientTipJointsToWorld.mel
Created January 20, 2013 20:56
Orients all tip joints to world. Alternative to orientTipJointsToParent.
// Orient tip joint to world
{
proc string[] getChildren(string $nodes[])
{
return `listRelatives -f -c $nodes`;
}
proc int isTip(string $node)
{
if (size(getChildren({$node})) > 0)
@jhoolmans
jhoolmans / CubeOnJoints.py
Created January 23, 2013 11:44
Create cube on joints
import pymel.core as pm
from pymel.core.datatypes import Matrix
for item in pm.ls(sl=True):
cube = pm.polyCube(ch=False)
mat = Matrix(pm.xform(item, m=True, ws=True, q=True))
pm.xform(cube, ws=True, m=mat)
pm.parent(cube, item)
@jhoolmans
jhoolmans / openclip.xml
Created September 19, 2017 11:31
Example for OpenClip files using patterns.
<?xml version="1.0" encoding="UTF-8"?>
<clip type="clip" version="5">
<handler>
<name>MIO Clip</name>
<version>2</version>
<longName>MIO Clip</longName>
<options type="dict">
<ScanPattern type="string">SH050_comp_v{version}.{frame}.exr</ScanPattern>
</options>
</handler>
@jhoolmans
jhoolmans / ArduinoClock.ino
Created March 26, 2018 21:09
ZS-042 DS3231 Clock and SSD1306 OLED (128x64) both on i2c with the Adafruit Trinket Pro.
// Pro Trinket - OLED Display Clock
//
// OLED (SSD1306)
// CLOCK (ZS-042)
//
#include "Wire.h"
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
@jhoolmans
jhoolmans / divideJoint.py
Created January 20, 2013 20:59
[Maya] Divide selected joint
import pymel.core as pm
# Helper methods
def debug(message):
print("DEBUG: %s" % message)
# Average between 2 nodes
def averageBetween(a, b):
return matrixLinearBetween(a, b, 0.5)
@jhoolmans
jhoolmans / softCluster.py
Created February 24, 2014 19:49
Maya create soft cluster
import maya.cmds as mc
import maya.OpenMaya as om
def softSelection():
selection = om.MSelectionList()
softSelection = om.MRichSelection()
om.MGlobal.getRichSelection(softSelection)
softSelection.getSelection(selection)
dagPath = om.MDagPath()