Skip to content

Instantly share code, notes, and snippets.

#Purpose: Removes all duplicate strings from a csv
#Author: Jake Gaylor
#Written: June 8th, 2012
import csv
#initiate the csv reader
reader = csv.reader(open('words.csv','rU'), delimiter=",", quotechar='|')
#open the target file
target = open('trimmed_list.txt', 'w+')
@jhgaylor
jhgaylor / gist:2903474
Created June 10, 2012 01:39
A sample of python class code
class MyClass:
def __init__(self, name): #this is your constructor
self.active = False #this is an atrribute of the object... because we are setting it without a parameter we will call this one a 'default' value
self.name = name #we set this attribute from a parameter
def rename(self, newname):
self.name = newname
return True
def __str__(self): #this is the function that will be called any time you try to print an instance of the class.
# linked_list.py
# A simple link-based list example
"""
linked_list - An link-based list implementation for Python.
Emulates an link-based list implementation via an internal collection of
linked-list nodes. Behaves like a normal Python list via operator overloading.
"""
import copy
@jhgaylor
jhgaylor / CRAZY.py
Created June 27, 2012 07:06
Bounding box craziness
#Author: Jake Gaylor
#Date: June 27, 2012
#@license: All rights reserved MSU SSRC
from math import radians, cos, sin, asin, sqrt, ceil
import geopy
from geopy.distance import VincentyDistance
@jhgaylor
jhgaylor / palindrome.py
Created June 28, 2012 04:06
basically what you need
myQueue = []
myString = "Tacocat"
myString.toLower()
for index,character in enumerate(myString):
myQueue.append(myString[index])
myStack = myQueue.reverse()
#include <stack>
#include <queue>
#include <cstdlib>
using namespace std;
string toLower(string strr)
{
char str[100];
string ret;
strcpy(str,strr.c_str());
#include <stack>
#include <queue>
#include <cstdlib>
using namespace std;
string toLower(string strr)
{
char str[100];
string ret;
strcpy(str,strr.c_str());
#include <stack>
#include <queue>
#include <cstdlib>
#include <string>
using namespace std;
string toLower(string strr)
{
char str[100];
#include <stack>
#include <queue>
#include <cstdlib>
#include <string>
using namespace std;
string toLower(string strr)
{
char str[100];
#include <stack>
#include <queue>
#include <cstdlib>
#include <string>
using namespace std;
string toLower(string strr)
{
char str[100];