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
/* | |
* taken from | |
* http://www.webreference.com/programming/javascript/rg17/ | |
* */ | |
Function.prototype.partial = function () { | |
var method = this; | |
var args = Array.prototype.slice.call(arguments); | |
return function() { | |
var allArguments = args.concat(Array.prototype.slice.call(arguments)); | |
return method.apply(this, allArguments); |
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
__author__ = 'jpablo' | |
## | |
import operator | |
from peak.rules import when, abstract | |
@abstract | |
def bind(obj, func): | |
'do something with obj and func' |
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
filter inv_stereo2 (image in, | |
float zoom:1-20(10), | |
float warp:-5-5(1), | |
float altura:1-20(2), | |
float rotx:0-6.2839(0), | |
float roty:0-6.2839(0), | |
float rotz:0-6.2839(0) | |
) | |
# mathmap: http://www.complang.tuwien.ac.at/schani/mathmap/ |
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
# Los datos (ejemplo) | |
d = c(2,4,6,6,7,11,13,13,14,15,19,23,24,27,28,28,28,30,31,43) | |
#### | |
dm <- mean(d) | |
ds <- sd(d) |
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 ruby | |
# has problems with spaces | |
# depends on: | |
# pstotext | |
# http://pages.cs.wisc.edu/~ghost/doc/pstotext.htm | |
def procesa(file) | |
p file |
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 ruby | |
## depends on: | |
## oggdec, lame, mp3info | |
def procesa(file) | |
base = `basename "#{file}" .ogg`.chop | |
tags = `vorbiscomment "#{file}"`.split("\n") | |
tags.collect! {|t| t.split("=")} |
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
# first, subclass property: | |
class ClassProperty(property): | |
def __get__(self, cls, owner): | |
return self.fget.__get__(None, owner)() | |
# then, define create_lazy_var | |
def create_lazy_var(cls,name, func): | |
private = '_'+name |
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 django.db import models | |
## given a Log container class, for example: | |
class MethodLog(models.Model): | |
occurred = models.DateTimeField(auto_now_add=True) | |
method = models.CharField(max_length=100) | |
## here's a class which logs all method calls and passes it | |
## to the contained object |
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
function asyncMap(promises, callback) { | |
var results = []; | |
for(var p in promises) { | |
if(!promises.hasOwnProperty(p)) { continue; } | |
promises[p].done(function(result) { | |
results.push(callback(result)) | |
}) | |
} | |
return $.when.apply(null,promises).pipe(function() { return results }); | |
} |
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
import com.google.common.collect.Iterables; | |
// ... | |
Iterable<String> items = Iterables.transform(getNodes("/List/Item", document), | |
new Function<Node, String>() { | |
public String apply(@Nullable Node node) { | |
//noinspection ConstantConditions | |
return node.getTextContent(); | |
} | |
}); |
OlderNewer