DispatchQueue.main.async {
// execute in main thread
}
DispatchQueue.global(qos: .background).async {
// execute in background thread
}
This file contains hidden or 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
#!/usr/bin/env python | |
from PySide import QtCore, QtGui | |
class KeyPressHandler(QtCore.QObject): | |
"""Custom key press handler""" | |
escapePressed = QtCore.Signal(bool) | |
returnPressed = QtCore.Signal(bool) | |
def eventFilter(self, obj, event): |
This file contains hidden or 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 Foundation | |
public extension Array where Element: Equatable { | |
public func frequencyOf(item: Element) -> Int { | |
return filter({ | |
if $0 == item { | |
return true | |
} else { | |
return false |
This file contains hidden or 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
#!/bin/bash | |
if [[ $1 =~ ([a-zA-Z\-]+)(\.git)$ ]] | |
then | |
# clone the repo | |
echo "-> cloning $1" | |
git clone $1 | |
# regex the directory name |
This file contains hidden or 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 maya.cmds as mc | |
def applyMaterial(node): | |
if mc.objExists(node): | |
shd = mc.shadingNode('lambert', name="%s_lambert" % node, asShader=True) | |
shdSG = mc.sets(name='%sSG' % shd, empty=True, renderable=True, noSurfaceShader=True) | |
mc.connectAttr('%s.outColor' % shd, '%s.surfaceShader' % shdSG) | |
mc.sets(node, e=True, forceElement=shdSG) | |
applyMaterial("pSphere1") |
This file contains hidden or 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
#!/bin/bash | |
var="$1" | |
if [ -z "$var" ] | |
then | |
var="$PWD" | |
fi | |
echo "cleaning up directory: $var..." | |
FILES=`find $var -name "*.pyc" -or -name "*.orig" -or -name "~*" -or -name "*~"` |