Skip to content

Instantly share code, notes, and snippets.

View strategy's full-sized avatar

Daniel Popa strategy

  • 16:34 (UTC +03:00)
View GitHub Profile
@strategy
strategy / mysql_recursive_tree_find.sql
Last active April 6, 2017 13:53
MySQL recursive tree find
-- Variables to change
-- L13: menu (mysql table)
-- L14: id_menu (mysql table id)
-- L18: 304 (child id from where to start finding the root id)
-- @ref: https://explainextended.com/2009/07/20/hierarchical-data-in-mysql-parents-and-children-in-one-query/
SELECT CONCAT(REPEAT(' ', level - 1), CAST(_id AS CHAR)) AS treeitem,
parent,
level
FROM (
@strategy
strategy / monopoly.py
Last active December 14, 2016 14:07
The Mathematics of Winning Monopoly (standupmaths & numberphile)
# &Copy standupmaths.com/ & numberphile.com
def monop(finish_order=6,games_order=3):
finish = 10**finish_order
games = 10**games_order
import random
from random import shuffle
squares = []