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
{
"metadata": {
"name": "",
"signature": "sha256:71de6f77b06d248aca60a5b61bbff3f9715f168edb8f07fc124ce7fd39612271"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@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
@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 / 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 / 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 / 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 / about.html
Created August 24, 2016 17:27
raw base camp coding academy about page html
<!DOCTYPE html>
<html>
<head>
<title>About &#8211; Base Camp Coding Academy</title>
</head>
<body>
<a href="https://basecampcodingacademy.org/">
<img width="300" height="82" src="https://basecampcodingacademy.files.wordpress.com/2015/12/basecamp_weblogo_2.png?w=300&amp;h=82&amp;crop=1" />
@natec425
natec425 / itemDecode.elm
Created October 26, 2016 15:08
Elm - Json.Decode reuse with Extensible Records
module Scratch exposing (..)
import Json.Decode exposing (..)
type alias Item a =
{ a
| field1 : String
, field2 : String
, field3 : String
@natec425
natec425 / finish.sh
Created April 17, 2017 16:46
Finish installing dotnet core on ubuntu 16.10
#! /bin/bash
set -e
echo "Downloading libicu55"
curl http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7ubuntu0.1_amd64.deb > libicu55_55.1-7ubuntu0.1_amd64.deb
echo "Installing libicu55"
sudo dpkg -i libicu55_55.1-7ubuntu0.1_amd64.deb
if [[ $UID != 0 ]]; then
echo "Please run this script with sudo:"
echo "sudo bash $0"
exit 1
fi
CODE_URL=https://az764295.vo.msecnd.net/stable/19222cdc84ce72202478ba1cec5cb557b71163de/code_1.12.2-1494422229_amd64.deb
CHROME_URL=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
GITKRAKEN_URL=https://release.gitkraken.com/linux/gitkraken-amd64.deb