Skip to content

Instantly share code, notes, and snippets.

View bugzPDX's full-sized avatar

Lisa Hewus Fresh bugzPDX

View GitHub Profile
@bugzPDX
bugzPDX / star_event.js
Created March 13, 2015 18:28
Star Module
var Stars = (function() {
var stars = [],
csrfToken,
signedIn = !!$('starred-event').length,
function initialSync() {
$.getJSON($('starred-event').data('get')).then(function(response) {
if (response) {
csrfToken = response.csrf_token;
@bugzPDX
bugzPDX / star_events.py
Created February 17, 2015 23:09
Star Events
from django.contrib.auth.models import User
from airmozilla.starred.models import StarredEvent, Event
me=User.objects.get(email='lfresh@mozilla.com')
events = Event.objects.all().order_by('?')[:30]
for event in events:
StarredEvent.objects.create(user=me, event=event)
StarredEvent.objects.all().count()
@bugzPDX
bugzPDX / populate_db.py
Created February 17, 2015 19:51
Creates Bulk Events
from django.utils import timezone
from django.core.management.base import BaseCommand
from airmozilla.main.models import Event
from airmozilla.starred.models import StarredEvent, Event
class Command(BaseCommand):
args = "Something"
help = "This is a help string"
def create_event(self):
airmozilla=# \d main_userprofile
Table "public.main_userprofile"
Column | Type | Modifiers
-------------+---------+---------------------------------------------------------------
id | integer | not null default nextval('main_userprofile_id_seq'::regclass)
user_id | integer | not null
contributor | boolean | not null default false
Indexes:
"main_userprofile_pkey" PRIMARY KEY, btree (id)
"main_userprofile_user_id" btree (user_id)
def assertRedirects(response, destination):
assert response.status_code == 302
assert response['Location'] == destination
new_response = self.client.get(destination)
assert new_response.status_code == 200
class Person(object):
def __init__(self, name):
self.name = name
class Student(Person):
def __init__(self, name, school):
Person.__init__(self, name)
self.school = school
def validate_active(self, value):
if (value):
survey = self.model
if (survey.questions.count == 0):
raise forms.ValidationError(
"Unable to activate survey without questions")
nosetests -x --verbosity=1
Reusing old database "test_airmozilla". Set env var FORCE_DB=1 if you need fresh DBs.
Raven is not configured (logging is disabled). Please see the documentation for more information.
E
======================================================================
ERROR: test_getuser_deleted (airmozilla.auth.tests.test_backend.TestBackend)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/lisa/Projects/airmozilla/airmozilla/airmozilla/auth/tests/test_backend.py", line 42, in test_getuser_deleted
user.delete()
@bugzPDX
bugzPDX / nosetestsbugzpdx.txt
Created October 15, 2014 19:00
Nosetests for Air Mozilla
nosetests --verbosity=1
Creating test database for alias 'default'...
Raven is not configured (logging is disabled). Please see the documentation for more information.
..................F................F...F..................................................No handlers could be found for logger "django.request"
......................................F.......................................................F........E.............................F.................................................................................................................F......F.................F.......................E.........................................................................................F......................
======================================================================
ERROR: test_event_duplication_with_curated_groups (airmozilla.manage.tests.views.test_events.TestEvents)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/lisa
@bugzPDX
bugzPDX / Jekyll_HTML-proofer
Created October 7, 2014 04:55
Output of Run on Local Machine First Then on Github
##This is from my home computer
$ bundle exec rake
bundle exec jekyll build
Configuration file: /Users/lisa/projects/ascendproject/_config.yml
Source: /Users/lisa/projects/ascendproject
Destination: /Users/lisa/projects/ascendproject/_site
Generating...
Build Warning: Layout 'none' requested in feed.xml does not exist.
done.