Skip to content

Instantly share code, notes, and snippets.

View derekmhewitt's full-sized avatar

Derek Hewitt derekmhewitt

  • Albany, OR
View GitHub Profile
# a python script for editing CSV inventory files and zeroing out values between 0 and 3 (easily editable)
import csv
with open("inventory.csv") as infile:
reader = csv.DictReader(infile)
with open("output.csv", "w") as outfile:
fieldnames = reader.fieldnames
writer = csv.DictWriter(outfile, fieldnames = fieldnames)
writer.writeheader()

Keybase proof

I hereby claim:

  • I am derekmhewitt on github.
  • I am derekmhewitt (https://keybase.io/derekmhewitt) on keybase.
  • I have a public key ASCGmsPcYmBGi74jRkGutiX2UJtlD4KR8X_V_mutF8BBPgo

To claim this, I am signing this object:

@derekmhewitt
derekmhewitt / gist:01866a810ca85f51a92717c6a29fea2c
Created September 26, 2016 00:28
Blog Post, Technical, Outline:
Title: Sublime Plugins that are Great like Frosted Flakes
This blog post will just be a walkthrough of setting up Sublime for use as a Python development environment. Intended audience: Python developers new to using Sublime Text
Things to explicitly discuss:
- Basic application setup
- Where to get the application
- Binding the ‘subl’ command so you can launch the app from the console (for linux/osx only)
- basic install instructions for Sublime packages
- installing package control
# -*- coding: utf-8 -*-
"""Week 7 Gist"""
from django.db import models
from django.contrib.auth.models import User
from django.http import HttpResponse
class BlogAuthor(models.Model):
user = models.OneToOneField(User, related_name='author_profile')
@derekmhewitt
derekmhewitt / gist:11e8e990aac053f972a62bea2335ef70
Created September 16, 2016 16:45
Code Fellows 401 Challenge Gist
# -*- coding: utf-8 -*-
"""
Code Challenge for this morning, an exercise in matching things up.
Write a function 'matcher()', takes two arguments. First is a string
with some parenthesies. Second string should take pairs of characters
that should be matched, examples: "()" or "()[]" or "''" < single
quotes. The inputs for matching will always be paired.
NFL Survivor Pool
User Stories
All pages
As a site user I want to be able to sign up/log in/log out from any page so that I can participate in the pool.
As a developer I want to utilize mobile-first design principals so that my site looks good on any device it’s viewed on.
As a developer I want to provide a clean, attractive interface free of popups, sounds or other obnoxious distractions to pool participants and potential pool participants.
Home page
As a new visitor I want to understand what a survivor pool is and what the rules are so that I can decide if I want to participate or not.
@derekmhewitt
derekmhewitt / gist:47b5dff3bc5debc1566cc607f0adb4c2
Created August 19, 2016 16:39
Python 401 Weekly Challenge #2
sample_string = "I am a very long string with some extra words that are silly."
def smart_substr(string, terminate="..."):
if len(string) < 30:
return string
else:
list_of_words = sample_string.split()
output = ""
while len(output) < 30:
@derekmhewitt
derekmhewitt / codechallenge.py
Last active August 12, 2016 18:41
Code Fellows 401 Code Challenge Friday August 12th
my_string_1 = 'here is a big string of words of arbitrary length'
my_string_2 = my_string_1.split()
# https://pointlessprogramming.wordpress.com/2011/02/24/reversing-a-string-in-python/
# ^^ Help reversing from here.
def reverse_string(stringy):
output = ""
for step in stringy: