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
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
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
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
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
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
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
# 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
#!/usr/bin/env coffee | |
guid = (length = 32) -> | |
chars = '0123456789abcdef' | |
result = '' | |
while length-- | |
result += chars[Math.floor(Math.random() * chars.length)] | |
return result |
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
_.mixin({ | |
missing: function(obj, requirements) { | |
var missing = {}; | |
_.each(requirements, function(requirement, field) { | |
if (_.isNull(obj[field]) || _.isUndefined(obj[field])) { | |
missing[field] = false; | |
return; | |
} | |
if (typeof obj[field] === 'object') { | |
potential = _.missing(obj[field], requirement); |