Skip to content

Instantly share code, notes, and snippets.

@jayd3e
jayd3e / gist:3239490
Created August 2, 2012 18:33
Doula traceback
2012-08-02 11:32:42,046 ERROR [doula][Dummy-10] Traceback (most recent call last):
File "/Users/joedallago/Projects/Doula/env/lib/python2.7/site-packages/doula/models/node.py", line 53, in load_services
a = Service.build_app(self.site_name, self.name, self.url, app)
File "/Users/joedallago/Projects/Doula/env/lib/python2.7/site-packages/doula/models/service.py", line 81, in build_app
a.supervisor_service_names = app['supervisor_service_names']
KeyError: 'supervisor_service_names'
@jayd3e
jayd3e / gist:3241515
Created August 2, 2012 22:40
Github doesn't normalize their responses
2012-08-02 15:29:48,427 ERROR [doula][Dummy-1] url=http://localhost:6543/login/github/callback?code=37dbc6987e4bc6e8be01 stacktrace=Traceback (most recent call last):
File "/Users/joedallago/Projects/Doula/doula/views/helpers.py", line 67, in exception_tween
response = handler(request)
File "/Users/joedallago/Projects/Doula/env/lib/python2.7/site-packages/pyramid-1.3.2-py2.7.egg/pyramid/tweens.py", line 20, in excview_tween
response = handler(request)
File "/Users/joedallago/Projects/Doula/env/lib/python2.7/site-packages/pyramid-1.3.2-py2.7.egg/pyramid/router.py", line 120, in handle_request
root = root_factory(request)
File "/Users/joedallago/Projects/velruse/velruse/providers/github.py", line 140, in callback
profile['displayName'] = data['name']
KeyError: 'name'
@jayd3e
jayd3e / gist:3308172
Created August 9, 2012 21:23
Velruse Error
Traceback (most recent call last):
File "/Users/joedallago/Projects/MonkeyBall/env/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/channel.py", line 329, in service
task.service()
File "/Users/joedallago/Projects/MonkeyBall/env/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/task.py", line 173, in service
self.execute()
File "/Users/joedallago/Projects/MonkeyBall/env/lib/python2.7/site-packages/waitress-0.8.1-py2.7.egg/waitress/task.py", line 380, in execute
app_iter = self.channel.server.application(env, start_response)
File "/Users/joedallago/Projects/MonkeyBall/env/lib/python2.7/site-packages/pyramid-1.3-py2.7.egg/pyramid/router.py", line 187, in __call__
response = self.handle_request(request)
File "/Users/joedallago/Projects/MonkeyBall/env/lib/python2.7/site-packages/pyramid-1.3-py2.7.egg/pyramid/tweens.py", line 20, in excview_tween
@jayd3e
jayd3e / gist:3502960
Created August 28, 2012 19:24
Confusing occurence
I have a number of entries in elasticsearch that look exactly like this:
{
"description": "This is a cool post.",
"created": 1346176373.0,
"due": 1346176373.0,
"author_id": 1,
"id": null,
"name": "Cool Post #3"
}
@jayd3e
jayd3e / gist:3613296
Created September 3, 2012 20:44
coffeescript error
add_active_class: (node) ->
node.className = node.className + " active"
remove_all_active_classes: (parent) ->
for child in parent.children: # erroring on this line
@remove_active_class child
set_score: (score) ->
object_score = undefined
@jayd3e
jayd3e / gist:3670179
Created September 7, 2012 22:13
Linkify
>>> from clusterflunk.filters import linkify
>>> linkify('http://example.com/bob?foo=bar&baz=you')
u'<a href="http://example.com/bob?foo=bar&baz=you">example.com/bob?foo=bar&baz=you</a>'
>>>
@jayd3e
jayd3e / gist:3670718
Created September 7, 2012 23:27
Sanitization solution
import lxml.etree
import lxml.html
import bleach
attrs = {}
tags = ['a']
def clean(text, max_length=50):
# replace urls with links
@jayd3e
jayd3e / gist:3741688
Created September 18, 2012 06:53
AJ HW
Chapter 1
Your Turn to Practice!
Author opening remarks 5:00
1a. When a person is talking, the listener is sometimes focused more on his/her response than listening to what the person
is saying. In addition the listener often fails to attend to the subtle variations of tone, accent, and
pitch in the speaker's speech. This can make it difficult to identify the speaker's interests. Throughout this book
you will have opportunities to practice sharpening your ability to discern what people are saying. As a warm-up,
@jayd3e
jayd3e / gist:3789169
Created September 26, 2012 16:56
Tiered Comment Notifications

Clustercomment

So I have been struggling with this problem for a bit now. The root of the problem is how does one properly notify people of when they receive comments on their content, when comments are tiered(meaning they form a tree of comments). For the purposes of this discussion, let's say our comments look something like this:

- comment(1) by danz
 |- comment(2) by jayd3e
   |- comment(4) by timtim
     |- comment(5) by jayd3e

|- comment(6) by bburd

'''
Functions to write:
(1) nopuncend(S) -- returns S with any trailing punctuation removed, where
a punctuation character is any of these: !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
NOTE: instead of typing these in yourself, this file defines punctuation
to be a string containing all these characters.
(2) notrail(S) -- returns S with any trailing whitespace characters removed,
where a whitespace character is any of these: \t\n\r (and blank of course)
NOTE: instead of typing these in yourself, this files deines whitespace
to be a string containing all these characters