Skip to content

Instantly share code, notes, and snippets.

Environment:
Request Method: POST
Request URL: http://staging.mapmyfitness.com/challenges/1/challenge/654/join/
Django Version: 1.3.4
Python Version: 2.6.6
Installed Applications:
['adminmodelaction',
@Jbot29
Jbot29 / gist:6f4c9bf0657a9ec37cbf
Created September 11, 2014 00:35
Yield Times each example
class MyFixNum
attr_accessor :num
def times
for x in 0..@num
yield x #if block_given?
end
end
end
name,type,amount,date
Expense1, deposit, 100.00, 9/9/2014
Expense2, withdraw, 200.00, 9/10/2014
Expense3, deposit, 500.00, 9/11/2014
Expense4, withdraw,50.00, 9/12/2014
lines = open('test.csv').read.split("\n")
header_line = lines[0]
header_fields = header_line.split(',')
rows = lines[1..lines.length] # or >>
data_rows = []
1) Create a new public github repo - After each step push to github.
2) Create a new rails app
3) Create a new model Video - two attributes title, link. Both strings
4) Create a new controller for this model
5) Fill out the create/new methods and views to allow a user to add a new video to the playlist with a html form.
@Jbot29
Jbot29 / gist:b84e5e2c6275d963f7f6
Last active December 30, 2024 23:52
Ecommerce User Stories + Steps

#User Stories - Overview

  1. Authentication: User can signup/login/logout

  2. Items for sale: User can view lists of items for sale and search by name, filter by price.

  3. Shopping Cart: User can add items to shopping cart and the app remembers it next time you login. User can view all the items in their shopping cart. User can delete items in the shopping cart. Shopping cart uses an integer column to store "state".

  4. Checkout: User can fill in form and submit billing info. After submitting billing info, items in the shopping cart will move to a different "state".

'''
Decorators:
A decorator is a wrapper around a function or a method.
By adding a decorator you can change a functions behavior without changing that function.
"""
Iterators are any class that implements the iterator protocol, what that basically means is a class that supports the following methods.
.next()
.__iter__()
Where .next() returns the next item in the sequence
and __iter__ just returns self
'''
Part 1: Make a program that keeps track of your budget. The user can type in commands via the terminal to make changes/add/show the budget.
- Create a program with a simple ui loop (a function that has a while loop which keeps the program running). THe loop will repeatedly display a list of commands and ask the user for input. (Commands are listed below)
- Once the input action is complete, display the list of command options again until the user quits (enters "q").
- Each command has an associated function that gets called when the user enters the right letter. You will write these functions.
Commands:
@Jbot29
Jbot29 / gist:8343f6b76ce08591aa0b
Created July 6, 2015 17:49
GoCode CSV Solution
'''
A csv file is a very simple file that is used quite often. Usually a csv file will look something like this
A simple expenses csv file
---
name,amount,monthly
food,1000.00,y
rent,2000.00,y