Skip to content

Instantly share code, notes, and snippets.

View jackgolding's full-sized avatar

Jack Golding jackgolding

View GitHub Profile
@jackgolding
jackgolding / Tic-Tac-Toe
Last active August 29, 2015 14:11
Tic-Tac-Toe Implementation in Python
#
# CONSTANTS
#
PLAYER_ICON = 'X'
BOARD_SIZE = 3
WELCOME_MESSAGE = ''
WIN_MESSAGE = ''
INVALID_MOVE_MESSAGE = ''
@jackgolding
jackgolding / gist:bb2a5431e0a6a815ddc2
Created December 16, 2014 04:52
Campaign Length Calculator
def campaign_month(t1, t2):
if t1 > t2:
return campaign_month(t2, t1)
month_dict = {}
if t2.month == t1.month and t2.year == t1.year:
month_dict[t2.month] = t2.day - t1.day + 1
else:
month_dict[t2.month] = t2.day
month_dict[t1.month] = monthrange(t1.year, t1.month)[1] - t1.day + 1
if t2.month - t1.month > 1:
@jackgolding
jackgolding / pollutantmean.py
Last active August 29, 2015 14:13
R Programming Assignment 1 in Python 3.4 Using Standard Libraries
'''
R Programming Programming Assignment 1 in Python 3.4 using only Standard Libraries
Example Usage:
pollutantmean('/Users/jackgolding/documents/specdata', 'sulfate', range(1,11))
4.064
'''
@jackgolding
jackgolding / python
Created January 27, 2015 09:04
[APSCHEDULER] cron jobs administrating a scheduled job
from apscheduler.jobstores.base import JobLookupError
from apscheduler.schedulers.background import BackgroundScheduler
import time
def hello():
print(time.localtime().tm_sec)
def kill_hello(scheduler):