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
.ghx-controls-filters, .ghx-qty, .ghx-issue-fields .ghx-key, .ghx-card-footer .ghx-type, .ghx-card-footer .ghx-flags, .ghx-card-footer .ghx-end, .ghx-card-footer .ghx-days, #announcement-banner { | |
display: none!important; | |
} | |
#ghx-pool-column { | |
padding: 0 20px; | |
} | |
.ghx-issue .ghx-highlighted-fields .ghx-highlighted-field { | |
max-width: none; |
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 trackClick(name) { | |
if (!name) throw "track needs a name"; | |
ga.track(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
questions_so_far = [] | |
answers_so_far = [] | |
@app.route('/') | |
def index(): | |
global questions_so_far, answers_so_far | |
question = request.args.get('question') | |
answer = request.args.get('answer') |
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
questions = { | |
1: 'Is your character yellow?', | |
2: 'Is your character bald?', | |
3: 'Is your character a man?', | |
4: 'Is your character short?', | |
} | |
characters = [ | |
{'name': 'Homer Simpson', 'answers': {1: 1, 2: 1, 3: 1, 4: 0}}, | |
{'name': 'SpongeBob SquarePants', 'answers': {1: 1, 2: 1, 3: 1, 4: 0.75}}, |
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 calculate_character_probability(character, questions_so_far, answers_so_far): | |
# Prior | |
P_character = 1 / len(characters) | |
# Likelihood | |
P_answers_given_character = 1 | |
P_answers_given_not_character = 1 | |
for question, answer in zip(questions_so_far, answers_so_far): | |
P_answers_given_character *= max( | |
1 - abs(answer - character_answer(character, question)), 0.01) |
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 calculate_probabilites(questions_so_far, answers_so_far): | |
probabilities = [] | |
for character in characters: | |
probabilities.append({ | |
'name': character['name'], | |
'probability': calculate_character_probability(character, questions_so_far, answers_so_far) | |
}) | |
return probabilities |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Bayer Akinator</title> | |
</head> | |
<body id="home"> | |
{% if result %} | |
<h1>You are thinking of {{ result }}!</h1> | |
{% else %} |
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 flask import Flask, render_template, request | |
# we will need those imports later | |
import random | |
import numpy as np | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): |
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
const express = require('express'); | |
const server = express(); | |
const request = require('request'); | |
const proxy = require('http-proxy-middleware'); | |
server.set('view engine', 'ejs'); | |
const createProxy = (path, target) => | |
server.use(path, proxy({ target, changeOrigin: true, pathRewrite: {[`^${path}`]: ''} })); |
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
x |> f = f x | |
something x = repeat x | |
|> filter (> 3) | |
|> map (+ 1) | |
|> take 5 |