Skip to content

Instantly share code, notes, and snippets.

@grodtron
grodtron / main.py
Created August 25, 2011 05:00
Test Gist
from names import name
def main():
print "hello " + name
if __name__ == "__main__":
main()
@grodtron
grodtron / gist_api.py
Created August 25, 2011 17:42
A gist to test the Gist API
#!/usr/bin/python
import urllib2
import base64
import json
filename = __file__.split("/")[-1]
data = {}
data["description"] = "A gist to test the Gist API"
@grodtron
grodtron / input_form.css
Created August 27, 2011 03:12
Another gist test
input.text, textarea { margin-bottom:12px; width:95%; padding: .4em; }
.ui-dialog textarea { height:100px; resize:vertical; }
echo "delete me";
@grodtron
grodtron / create_gist.py
Created August 27, 2011 04:30
a function that acts as an intermediary between ajax and the github gist api in my django application
def createGist(request):
if(request.method == "POST"):
data = {}
data["description"] = request.POST["description"]
data["public"] = True
filename = request.POST["filename"]
data["files"] = {filename:{}}
data["files"][filename]["content"] = request.POST["content"]
@grodtron
grodtron / create_gist.py
Created August 27, 2011 04:39
A function that acts as an intermediary between ajax and github in my django application
def createGist(request):
if(request.method == "POST"):
data = {}
data["description"] = request.POST["description"]
data["public"] = True
filename = request.POST["filename"]
data["files"] = {filename:{}}
data["files"][filename]["content"] = request.POST["content"]
@grodtron
grodtron / COEN_243_Assignment_1.cpp
Created September 14, 2011 12:45
drawing with cpp
/*
* COEN 243 Assignment 1, Question 1.
*
* You are working in the IT department a logistics company that transports boxes of cornflakes
* from New York to Montreal. Each box contains 15 ounces of cornflakes. You have been asked to
* implement an application that, for a given order in metric tons, calculates the number of
* cornflakes boxes required to fill the order.
*
* Gordon Bailey (9541098)
* Sep 11, 2011
@grodtron
grodtron / rotation.py
Created September 21, 2011 00:19
set of functions to rotate a vector in space. main() rotates so that vector is fully along Z axis
#!/usr/bin/python
from sympy import Matrix
from math import sin, cos, pi, atan, sqrt
def degToRad(t):
"""docstring for degToRad"""
return t * (pi/180)
def rotateAroundX(v, theta):
@grodtron
grodtron / pager.html
Created September 22, 2011 03:10
a liquid/adaptive paginator for a site I'm building
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>menu test</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
@grodtron
grodtron / inflation.cpp
Created September 28, 2011 13:36
class assignment 2 - mostly about loops and stuff
/*
* Write a program that estimates the inflation rate for the past year. The program prompts the user for
* the current and last year prices of a representative item (e.g., milk, bread, etc.). It then calculates and
* prints the inflation rate (as a percent value) by analyzing the price difference. In addition, the program
* prints out an estimate, based on the calculated inflation rate, of the price of the item one and two years
* hence. Your program should allow the user to repeat the estimation as often as the user wishes. Use
* functions to calculate the inflation rate and the price estimation.
*
*/