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 url('https://github.com/adobe-fonts/source-serif/blob/release/source-serif-display.css'); | |
{ | |
font-family: 'Source Serif', serif; | |
} |
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 STARTING_ELO = 100 | |
const K = 2 | |
function normalized_win_probability(player_elo, total_game_elo, player_count) { | |
const avg_opponent_elo = (total_game_elo - player_elo) / (player_count - 1) | |
// Standard ELO algorithm with opponent ELO avged because we have more than one opponent | |
const win_probability = 1 / (1 + Math.pow(10, (avg_opponent_elo - player_elo) / STARTING_ELO)) | |
// Normally ELO is calculated for 1 vs 1 games. We need to normalize the probability with the number of players. |
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
# VPOD spawning utils file sinipits | |
# Spawning new VPODs | |
# Also checks the JSON responce for errors and throws if VPODs api errored | |
def __check_json_for_errors(json): | |
error_name = f"Error {json.get('error')}: " if json.get('error') else '' | |
error_msg = f"\"{json.get('message')}\"" if json.get('message') else '' | |
error_full = f"Error: {json.get('errorMsg')}" if json.get('errorMsg') else '' | |
error = f'{error_name}{error_msg}{error_full}' |
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
defmodule Sizzle.FlameFormaters.FlameEvent do | |
def unknown_event(unknown_log_line) do | |
# At a later date I should probably refactor this into something with more information | |
unknown_log_line | |
end | |
def frame_start(request_time, frame_type, frame_name, line_number, tags \\ %{}) do | |
%{ | |
"event" => "Frame.start", | |
"time" => request_time, |
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
[1,2,3] |> map(fn number -> my_function(number) end) | |
[1,2,3] |> reduce([], fn number, acc -> acc ++ [ my_function(number) ] end) |
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 increment(enums, head) do | |
# enums, and all of their heads (start of list) | |
# accumulator = {carry, enums} | |
zip(enums, head) | |
|> foldr({true, []}, fn | |
{[_ | []], head}, {true, acc} -> {true, [head | acc]} | |
# {if the list has no more elements} and {carry in} -> {carry out and set back to begining on list (head)} | |
{[_ | tail], _head}, {true, acc} -> {false, [tail | acc]} | |
# {if the list does have more elements} and {carry in} -> {do NOT carry out and move to next element in list (tail)} | |
{enum, _head}, {false, acc} -> {false, [enum | acc]} |
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
defmodule BreadthFirst do | |
defp init_cursor(dimension) do (for _ <- 1..dimension, do: 0) end | |
defp increment_cursor(cursor, depth, max, carry) do | |
cursor | |
|>List.foldr( | |
{carry, false, []}, | |
fn elem, {carry, unique, acc} -> | |
case elem + carry do |
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
defmodule T do | |
defp init_cursor(dimension) do (for _ <- 1..dimension, do: 0) end | |
defp increment_cursor(cursor, depth) do | |
max = depth-1 | |
cursor | |
|>List.foldr( | |
{1, false, []}, |
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
defmodule Test do | |
defp add(product, {i, list_i}, {j, list_j}, max) do | |
p = [{elem(list_i, i), elem(list_j, j)} | product] | |
reverse(p, {j, list_i}, {i+1, list_j}, max) | |
end | |
defp reverse(product, {i, list_i}, {j, list_j}, max) do | |
p = [{elem(list_i, i), elem(list_j, j)} | product] |
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 person = {sutff:"stuff"}; | |
Object.defineProperty(person, 'fullName', { | |
get: function() { | |
return firstName + ' ' + lastName; | |
}, | |
set: function(name) { | |
var words = name.split(' '); | |
this.firstName = words[0] || ''; | |
this.lastName = words[1] || ''; | |
} |
NewerOlder