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
// Calculate the mean of a set. | |
var i; | |
var result = 0; | |
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // age. | |
var absFrec = [9, 8, 7, 6, 5, 4, 3, 2, 1]; // absolute frecuency. | |
var N = 0; // Total value of the set. | |
for (i = 0; i < data.length; i++) { | |
N += absFrec[i]; |
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
var words = (function(){ | |
var sWords = document.body.innerText.toLowerCase().trim().replace(/[.,;?¿@]/g,' ').split(/[\s\/]+/g).sort(); | |
var iWordsCount = sWords.length; // count w/ duplicates | |
// array of words to ignore | |
var ignore = ['and','the','to','a','of','for','as','i','with','it','is','on','that','this','can','in','be','has','if', | |
'de', 'del', 'y', 'en', 'que', 'para', 'tu', 'con', 'su', 'mas', 'o', | |
'el','te', 'ti', 'un', 'lo', 'los', 'la', 'las', 'una', 'más', 'sus', 'este', 'desde', 'tras', | |
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
var k_total = 10; // number of times the event is repeated | |
var landa = 8; // Promedian number of error expected in a given time (Landa symbol) | |
var exponential = 2.718281828; | |
var total = 0; | |
var numerator, denominator; | |
// Sumatorio de k terminos usando la formula de poisson | |
function poisson(k, landa) { |
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
// Binomial coefficient | |
// Credits: github.com/jgferreiro | |
examples(); | |
function examples() { | |
var a, b; // numerator and denominator of our coeffiecient | |
a = 2; b = 1; | |
console.log('Binomial for a = ' + a + " and b = "+ b + ' is ' + binomialCoefficient(a, 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
# MapReduce: gasto total realizado por las mujeres que han realizdo EXACTAMENTE | |
# 3 compras. | |
@get('/spending_female_3_orders_mr') | |
def spending_female_3_orders_mr(): | |
mapper = Code(""" | |
function countryMap() | |
{ | |
if (this.gender == "Female") { |
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
# Subject classs. That has a constructor (__init__) and a method (getSubjectInfo) | |
class Subject: | |
def __init__(self, name, teacher, year, degree): | |
self.name = name | |
self.teacher = teacher | |
self.year = year | |
self.degree = degree | |
def getSubjectInfo(self): | |
info = "-------------------------------------\n" |
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 random import randint | |
games = [] # It's a list og games where each element is a dictionary {'name': '', 'type':'', 'used': False|True} | |
cons_type = ['inteligencia','deporte','aventura','familiar'] | |
cons_numPlayers = ['uno', 'dos', 'MasDeDos'] | |
cons_difficulty = ['facil', 'media', 'dificil'] | |
cons_time = ['poco', 'medio', 'mucho'] | |
cons_age = ['TP', 'Mas13', 'Mas18'] |
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
git config credentials.helper osxkeychain |
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
log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow) %d%C(reset)' --all | |
git config --global alias.superlog "PONER LO DE ARRIBA" |
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
class CracklePop(object): | |
def __init__(self, left, right): | |
self.left = left | |
self.right = right | |
# Private methods | |
def valid_bounds(self): | |
left = self.left | |
right = self.right |
OlderNewer