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
# Based on: http://seatgeek.com/blog/dev/fuzzywuzzy-fuzzy-string-matching-in-python | |
_ = require 'underscore' | |
token_regex = /\w+/g | |
trim_regex = /^\s+|\s+$/g | |
levenshtein_dist = (a, b) -> | |
throw new TypeError('a is empty') unless _.isString(a) | |
throw new TypeError('b is empty') unless _.isString(b) |
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
package set | |
type Set map[interface{}]struct{} | |
func (this *Set) Contains(m *interface{}) (exists bool) { | |
s := *this | |
_, exists = s[m] | |
return | |
} |
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
fs = require 'fs' | |
path = require 'path' | |
redis = require('redis').createClient() | |
multi = redis.multi() | |
console.log 'Reading...' | |
fileName = process.argv.slice(-1)[0] | |
filePath = path.join process.cwd, fileName | |
fileStream = fs.createReadStream filePath |
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
func ApproxTanh(x float64) float64 { | |
if x > 21 { | |
return 1 | |
} | |
if x < -21 { | |
return -1 | |
} | |
if x == +0 { | |
return +0 | |
} |
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
BoxCollider collider = gameObject.AddComponent<BoxCollider>(); | |
Bounds parentBounds = new Bounds(Vector3.zero, Vector3.zero); | |
Bounds childBounds = new Bounds(Vector3.zero, Vector3.zero); | |
MeshFilter[] meshFilters = transform.GetComponentsInChildren<MeshFilter>(); | |
foreach (MeshFilter meshFilter in meshFilters) { | |
childBounds.center = transform.InverseTransformPoint(meshFilter.renderer.bounds.center); | |
childBounds.size = meshFilter.sharedMesh.bounds.size; | |
parentBounds.Encapsulate(temp); | |
} |
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 math import sqrt, exp, pi | |
import pygtk | |
pygtk.require('2.0') | |
import gtk | |
import numpy as np | |
def make_kernel(radius): | |
width = radius * 2 + 1 |
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 math import ceil | |
import pygtk | |
pygtk.require('2.0') | |
import gtk | |
import numpy as np | |
from scipy import ndimage |
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
Shader "Diffuse Lightmap" { | |
Properties { | |
_MainTex ("Texture 1", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType" = "Opaque" } | |
Pass { |
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 unfreezeTransformations(selection): | |
originalCenter = cmds.getAttr('%s.center' % selection)[0] | |
cmds.move(originalCenter[0] * -1, originalCenter[1] * -1, originalCenter[2] * -1, selection, absolute=True) | |
cmds.makeIdentity(selection, apply=True, translate=1, rotate=1, scale=1, normal=0) | |
cmds.move(originalCenter[0], originalCenter[1], originalCenter[2], selection, absolute=True) |
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
#define INTENSITY 6.5 | |
float blob(vec2 uv, vec2 speed, float time) { | |
// Compute a moving point | |
vec2 point = vec2( | |
sin(speed.x * time), | |
cos(speed.y * time) | |
); | |
float d = 1.0 / distance(uv, point) / INTENSITY; |