Skip to content

Instantly share code, notes, and snippets.

View evitolins's full-sized avatar
🏠
Working from home

Eriks Vitolins evitolins

🏠
Working from home
View GitHub Profile
@evitolins
evitolins / javascript_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@evitolins
evitolins / 0_reuse_code.js
Last active August 29, 2015 14:10
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
#Open New Maya
from subprocess import call
appPath = "/Applications/Autodesk/maya2014/Maya.app"
call(["open -n " + appPath], shell=True)

RGB: ScriptManager

About

'ScriptManager' gives both Maya users & developers a simple and standardized workflow for the installation and removal of 3rd-party Maya scripts. Files are stored and maintained in an organized fashion, doing away with the process of hand-copying files into their intended Maya folders.

@evitolins
evitolins / getFilteredList.py
Last active March 8, 2017 06:29
Python: Filter list by prefix and/or suffix
def getFilteredList(list=[], pfx='', sfx=''):
filteredList = []
for item in list:
isMatch = False
if pfx and not sfx: isMatch = item.startswith(pfx)
if not pfx and sfx: isMatch = item.endswith(sfx)
if pfx and sfx: isMatch = item.startswith(pfx) and item.endswith(sfx)
if isMatch: filteredList.append(item)
return filteredList
@evitolins
evitolins / php2json.php
Last active August 29, 2015 14:07
Simple PHP -> JSON Usage
<?
/**
*
* Returns an array as JSON formatted data
*
*/
// Automatically Gather Images from a directory
$autoImageList = array();
foreach(glob('./images/*.{jpg,png,gif}') as $filename){
@evitolins
evitolins / README.md
Last active August 29, 2015 14:07
Python: Modules, Classes & Objects

Python: Modules, Classes & Objects

So in Python you have 3 major tools for code organization…Modules, Classes, & Objects

Modules:

Python modules are pretty much just a single python file. You can think about it as giving your variables and functions a specific namespace to reference within another python script. For example: The code below imports the contents of "mySampleModule.py" to allow all it's contents to be used in another python script under it's namespace (by default, the filename).

import mySampleModule

@evitolins
evitolins / RRM_utils.py
Last active December 21, 2023 18:45
Maya Python Snippets
'''
This fixes a RRM bug (v1.4.7) where saved RRM setups do not preserve a
module's 'pinned' status.
'''
import maya.cmds as cmds
import maya.mel
def RRM_fixPinBug(objs):
for obj in objs:
trans = cmds.xform(obj,q=True, r=True, translation=True)
maya.mel.eval("RRM_PinProxies(1, 0);")
@evitolins
evitolins / commandPort.py
Created August 31, 2014 17:42
Maya CommandPort methods to assist with MayaSublime package integration.
import maya.cmds as cmds
def activateCommandPort(host='127.0.0.1', port='7002', language="python"):
path = host + ":" + port
active = cmds.commandPort(path, q=True)
if not active:
cmds.commandPort(name=path, sourceType=language)
else:
print("%s is already active" % path)
@evitolins
evitolins / dataModel.coffee
Created August 11, 2014 16:00
A simple class for manipulating key/value pairs, and applying associated callbacks.
class DataModel
constructor: () ->
@data = {}
@callbacks =
set: []
unset: []
return
applyCallbacks: (action, args) ->
for cb in @callbacks[action]