Skip to content

Instantly share code, notes, and snippets.

View jakul's full-sized avatar
🏳️‍🌈
LGBT and proud

Craig Blaszczyk jakul

🏳️‍🌈
LGBT and proud
View GitHub Profile
@jakul
jakul / gist:1139175
Created August 11, 2011 08:36
Introspection rules example
class RegexField(CharField):
def __init__(self, regex=None, *args, **kwargs):
self.regex = regex
super(CharField,self).__init__(*args, **kwargs)
def formfield(self, **kwargs):
from django import forms
defaults = {
'form_class': forms.RegexField,
def _pofile_or_mofile(f, type, **kwargs):
# ... snip
default_klass = type == 'pofile' and POFile or MOFile
klass = kwargs.get('klass', default_klass)
parser = kls(
f,
encoding=enc,
check_for_duplicates=kwargs.get('check_for_duplicates', False),
@jakul
jakul / gist:3899550
Created October 16, 2012 14:20
Redis 2.0.0 error on Ubuntu Lucid
[2012-10-16 14:16:57,037: INFO/MainProcess] consumer: Connected to redis://localhost:6379/1.
[2012-10-16 14:16:57,047: ERROR/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
File "/srv/networklocum/lib/python2.6/site-packages/celery/worker/consumer.py", line 390, in start
self.consume_messages()
File "/srv/networklocum/lib/python2.6/site-packages/celery/worker/consumer.py", line 402, in consume_messages
with self.hub as hub:
File "/srv/networklocum/lib/python2.6/site-packages/celery/worker/hub.py", line 190, in __enter__
self.init()
File "/srv/networklocum/lib/python2.6/site-packages/celery/worker/hub.py", line 144, in init
INFO in views [/d/nllocationservice/location_service/views.py:113]:
Querying the database with: '{'loc': SON([('$near', [51.521706399999999, -0.072289300000000001]), ('$maxDistance', 0.28939372015627263)]), 'type': u'jobs'}'
--------------------------------------------------------------------------------
2012-10-17 15:07:46 [2697] [ERROR] Error handling request
Traceback (most recent call last):
File "/home/administrator/.virtualenvs/nl-loc/lib/python2.6/site-packages/gunicorn/workers/sync.py", line 102, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/home/administrator/.virtualenvs/nl-loc/lib/python2.6/site-packages/flask/app.py", line 1701, in __call__
return self.wsgi_app(environ, start_response)
File "/home/administrator/.virtualenvs/nl-loc/lib/python2.6/site-packages/flask/app.py", line 1689, in wsgi_app
Error in migration: squawk:0005_auto__chg_field_transmissionlog_gateway_status__chg_field_transmission
Traceback (most recent call last):
File "./manage.py", line 31, in <module>
execute_manager(settings)
File "/home/administrator/.virtualenvs/nl-redflash/lib/python2.6/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/home/administrator/.virtualenvs/nl-redflash/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/administrator/.virtualenvs/nl-redflash/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
function validate_auth_urls(req, path, httpMethod) {
/*
* Ensure that only client API keys can access the auth urls
*/
if (!path.startswith('/auth/')) {
return true
}
@jakul
jakul / gist:5207440
Last active December 15, 2015 05:09
// the below doesn't work when IE7's privacy settings are set to block 3rd party cookies
$('.got-question').click(function(){
if (typeof(window.olark) !== "undefined") {
//olark is present
}
else {
//olark is absent
}
});
git for-each-ref --format='%(refname:short) <- %(upstream:short)' refs/heads
@jakul
jakul / gist:6493286
Created September 9, 2013 09:12
check connection to github
administrator@vagrant-craig:~$ ssh git@github.com
Hi craig! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
# Khan's machine
_add_platform(
'vagrant-khan',
custom_defaults=_DEV_DEFAULTS,
...