Skip to content

Instantly share code, notes, and snippets.

@lucassus
lucassus / bayesian rating
Created June 6, 2018 06:18 — forked from latompa/bayesian rating
bayesian rating
-- building on data from my scenario http://gist.github.com/44489
-- and bayesian rating http://www.thebroth.com/blog/118/bayesian-rating
assume we have a products table and we want to sort products based on their rating.
With bayesian rating, you get better weighting, so that a single 5 star vote won't show up as "top product"
select * from products;
mysql> select * from products;
+------+--------+---------------+--------------+---------+
| id | name | ratings_count | total_rating | weight |
<html ng-app="ng-demo-app">
<head>
<title>AngularJS simple app demo</title>
</head>
<body ng-controller="MainCtrl">
<input type="text" ng-model="name" ng-required>
<div>{{name}}</div>
<div ng-controller="ChildCtrl">
<input type="text" ng-model="salut">
<div>{{salutation}}</div>
<script>
// inject inlined constants
angular.module('app.constants', [])
.constant('contextPath', '${pageContext.request.contextPath}');
</script>
_.mixin({
// Get/set the value of a nested property
deep: function (obj, key, value) {
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'),
root,
i = 0,
n = keys.length;
/**
* __proto__ and prototype
* - the __proto__ property the instance's 'parent' up the prototype chain
* - the prototype property refers what new instances of the type will have their __proto__ set to, i.e. what will be the new instance's 'parent' up the prototype chain
*/
/* Given */
function Object () {}
Object.prototype = {
__proto__: null
sinon / chai / mocha / js-tests
_____________________________________
#### chai
expect(subject).not.equal(expected)
.a('string')
.instanceof(Foo)
#!/bin/bash
#byzanz-record-window
#dependency checks
if ! which xwininfo &>/dev/null; then
echo "Dependency xwininfo not met."
deps_ok=NO
fi
if ! which byzanz-record &>/dev/null; then
echo "Dependency byzanz not met."

Coworking w Krakowie

Studio Kreatywnej Współpracy

http://www.studioprzylea.pl

Adres: ul. Juliusza Lea 10a/7, ul. Królewska 2/2

  • miesiąc - 420 + VAT
  • 10 dni - 230 + VAT
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@lucassus
lucassus / 0-readme.md
Created November 13, 2012 12:00 — forked from div/0-readme.md
ruby-1.9.3-p286 cumulative performance patch.

Patched ruby 1.9.3-p286 for 30% faster rails boot + with support of utf-8 console input

What is?

This script installs a patched version of ruby 1.9.3-p286 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.