Skip to content

Instantly share code, notes, and snippets.

import os
import time
from random import randint
os.system('cls' if os.name == 'nt' else 'clear')
DOWN = "Down"
RIGHT = "Right"
DESTINATION = "Destination!"
EMPTY_CHAR = "[ ]"
OBSTACLE_CHAR = "[X]"
@reeddunkle
reeddunkle / leo_int_list_comprehension
Created May 30, 2016 23:01
convert r, c to int()
#Leo, I found a better way. Look where I moved the int() call to:
r, c = [int(c) for c in user_input if c.isdigit()][:2]
# r = int(r)
# c = int(c)
@reeddunkle
reeddunkle / backtrack_leo3.py
Last active June 3, 2016 20:28
Obstacles not being drawn in the correct squares
"""
backtrack2.py
-------------
Converting backtrack to OOP:
"""
"""
Notes: June 3
Obstacles seem to be being drawn in the wrong squares
@reeddunkle
reeddunkle / ipython.md
Created June 17, 2016 14:21 — forked from jjst/ipython.md
ipython install & cheat sheet

Getting started

Install

pip install ipython

If you also wanna use the notebook:

@reeddunkle
reeddunkle / Rename_GitHub_Repo.md
Last active June 26, 2016 18:56
So that I stop forgetting what to do

When you rename a Python GitHub Repo:

Fix the URL that your local repository uses to find its remote respository

  • Copy your repo's new URL, and head to the terminal:
git remote -v  # See your old URL
git remote set-url origin https://github.com/[your-name]/**[NEW-REPO-NAME].git**
@reeddunkle
reeddunkle / Three Python Plotting Options.ipynb
Created June 21, 2016 19:08 — forked from bhtucker/Three Python Plotting Options.ipynb
An intro to some easy, interactive data visualization tools
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reeddunkle
reeddunkle / script.py
Last active July 9, 2016 15:27
Roll a die with optional weighted side and specified weight
import random
def is_int(x):
'''
Given a number, returns a boolean declaring if
the number is an integer.
'''
return x % 1 == 0
@reeddunkle
reeddunkle / run_length.py
Created July 20, 2016 15:59
An example of decoding RLE with itertools.groupby()
def decode(compressed):
'''
Given an Run Length Encoded (RLE) string, decodes it
into its original format, and returns this decoded string.
'''
groups = groupby(compressed, lambda x: x.isdigit())
output = ''
count = 1
@reeddunkle
reeddunkle / cut_sticks.py
Last active July 26, 2016 20:44
Reed and Leo: Almost Purely Functional Python
def nest_while(f, value, condition):
'''
Given function, initial value, and break condition,
calls function with the initial value, and repeats calling
the function with the return value of the previous call,
until the condition returns false.
'''
if not condition(value):
return value
return nest_while(f, f(value), condition)
@reeddunkle
reeddunkle / angular_to_aurelia_reference.md
Created April 20, 2017 12:36
Migrating to Aurelia from Angular 1.x

{ "name": "Migrating to Aurelia from Angular 1.x", "culture": "en-US", "description": "If you have an existing Angular application that you would like to migrate to Aurelia, you can use the conversion guides and implementation notes here to streamline the process.", "engines" : { "aurelia-doc" : "^1.0.0" }, "author": { "name": "Jedd Ahyoung", "url": "http://www.jedd-ahyoung.com" },