Skip to content

Instantly share code, notes, and snippets.

View wjdp's full-sized avatar
:shipit:
Shipping things

Will Pimblett wjdp

:shipit:
Shipping things
View GitHub Profile
@wjdp
wjdp / gist:5789194
Created June 15, 2013 19:05
Django settings.py for SO question re. django-cms adding language strings to urls
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_PATH = os.path.join(os.path.dirname(__file__),'..')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@wjdp
wjdp / gist:10118593
Created April 8, 2014 12:45
int MoveableObject::CollisionY
int MoveableObject::CollisionY(bool bToJump)
{
int iDesired;
if (bToJump)
{
int iDirection = 1;
int iDesired = m_iCurrentScreenY + m_iCollisionY + m_iCollisionHeight + 1;
printf("%d %d\n", iDesired, m_iCurrentScreenY + m_iCollisionY + m_iCollisionHeight);
}
else
@wjdp
wjdp / gist:10169703
Created April 8, 2014 18:44
Platform Level
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"x-xcvbsdfgwertp----------------x",
"x------------------------------x",
"x------------------------------x",
"x------------------------------x",
"x------------------------------x",
"x------------------------------x",
"x------------------------------x",
"x------------------------------x",
"x-----------xxxxx----------xx--x",
@wjdp
wjdp / stdout
Created November 9, 2014 19:35
./manage.py migration hang
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/will/env/xSACdb-dj7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/will/env/xSACdb-dj7/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/will/env/xSACdb-dj7/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/will/env/xSACdb-dj7/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def copy_users(apps, schema_editor):
User = apps.get_model('auth','User')
XSDUser = apps.get_model('xsd_auth','XSDUser')
for old_user in User.objects.all():
new_user = XSDUser()
@wjdp
wjdp / stdout
Created December 6, 2014 15:38
WebIDE, Linux, iPhone4
console.log: Connection status changed: connecting
console.error:
Handler function DebuggerClient.requester request callback threw an exception: Error: 'getAll' request packet has no destination.
Stack: DebuggerClient.prototype.request@resource://gre/modules/devtools/dbg-client.jsm:667:1
AppActorFront.prototype.watchApps@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/app-actor-front.js:570:35
exports.AppManager.onConnectionChanged/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource:///modules/devtools/webide/app-manager.js:112:9
DebuggerClient.requester/</<@resource://gre/modules/devtools/dbg-client.jsm:348:9
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:83:14
emit@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:96:9
@wjdp
wjdp / phone_validation.py
Last active August 29, 2015 14:17
Django quick and dirty phone validation
from django.core.validators import validate_integer
from django.core.exceptions import ValidationError
MIN_PHONE_LENGTH = 11
MAX_PHONE_LENGTH = 15
def validate_phone(input):
"""Validate a phone number"""
no_symbols = re.sub(r'[^\w]', ' ', input)
no_symbols_or_whitespace = no_symbols.replace(' ', '')
@wjdp
wjdp / profile.rb
Last active August 29, 2015 14:22
Jekyll build profiling
module Jekyll
class Site
def render
relative_permalinks_deprecation_method
payload = site_payload
collections.each do |label, collection|
collection.docs.each do |document|
t1 = Time.now
if true
@wjdp
wjdp / include_root.rb
Last active February 28, 2016 22:12
[Jekyll3] Adds an include_root tag, works like include_relative but starts from the root of the project
module Jekyll
module Tags
class IncludeRootTag < IncludeTag
def resolved_includes_dir(context)
'.'.freeze
end
end
end
end
@wjdp
wjdp / stderr
Created December 15, 2015 02:24
newtheatre/history-project #395
Running ["HtmlCheck", "ImageCheck", "FaviconCheck", "LinkCheck", "ScriptCheck"] on ./_site on *.html...
Found 16679 links in the cache...
Adding 0 links to the cache...
Removing 0 links from the cache...
Checking 0 external links...
Ran on 2308 files!