Skip to content

Instantly share code, notes, and snippets.

View natec425's full-sized avatar
🙃
Software Developer. Educator.

Nate Clark natec425

🙃
Software Developer. Educator.
View GitHub Profile
@natec425
natec425 / add_atom_to_path.py
Created June 13, 2016 19:16
add atom to path
from os import system
system("ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom")
@natec425
natec425 / chapter3_exercise.py
Created June 8, 2016 13:11
Chapter 3 Exercises
# Chapter 3 Homework assignment
#
# These problems are modified versions of the programming exercises
# in Starting out with Python (2nd edition) by Tony Gaddis.
#
# You should complete the provided functions so that they pass all the
# provided tests. To complete a function, remove the "pass" (which
# is a statement to do nothing) and implement the function.
#
# To test your code, simply run this module. If your module runs
@natec425
natec425 / snippet.cson
Created June 7, 2016 18:34
Function Design Recipe Snippet
".source.python":
"Function Design Recipe":
"prefix":"recipe"
"body":"""
def ${1:function_name}(${2:parameters}):
\"\"\" ${3:type signature}
${4:description}
${5:examples}
@natec425
natec425 / stream_conway.scala
Created November 19, 2014 15:56
Stream-based Conway
import util.Random
class Field(val height : Int, val width : Int, theDecider : (Int, Int) => Boolean) {
val grid = for ( i <- 0 until height )
yield (for ( j <- 0 until width ) yield theDecider(i,j))
def isInBounds(row : Int, col : Int) : Boolean =
(0 <= row && row < height) && (0 <= col && col < width)
def isOccupied(row : Int, col : Int) : Boolean =
@natec425
natec425 / conway.scala
Created November 19, 2014 03:58
Nate's Conway
import util.Random
// not necessary, but my original idea
// class Field(val width: Int, val height: Int, factory: (Int, Int) => Boolean) {
// val grid = tabulate(width, height)(factory)
// more reasonable thing (like what you did)
class Field(val height : Int, val width : Int) {
// kinda funky to read, but its a 2d vector of random booleans
{
"metadata": {
"name": "",
"signature": "sha256:71de6f77b06d248aca60a5b61bbff3f9715f168edb8f07fc124ce7fd39612271"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [