text = open('a_unicode_file.txt', 'r').read()
print text
print 'type:', type(text) # str is a container for binary data
print 'bytes:', len(text) # The number of bytes, not characters!
print ' '.join(repr(b) for b in text)
print 'first byte:', text[:1] # Prints an invalid character!
var preloadImage = function(url, callback) { | |
var loaded = false, | |
loadHandler = function() { | |
if (!loaded) { | |
callback(url); | |
} | |
loaded = true; | |
}, | |
img = $('<img>') | |
.one('load', loadHandler) |
#!/bin/bash | |
# To add two items to the current .gitignore file: | |
# gitignore '*.swp' bin | |
# | |
# To sort and de-dupe the current .gitignore file: | |
# gitignore | |
# Append each argument to its own line: | |
for item in "$@"; do | |
echo "$item" >> .gitignore; |
#!/usr/bin/env python | |
import re | |
import sys | |
def rep(sval): | |
return str(int(sval.group()) * 2) | |
if __name__ == '__main__': |
Twig World is looking to recruit a highly skilled and motivated Python developer to build and maintain our portfolio of award-winning educational online products.
The successful candidate will be joining a small, collaborative team in our Glasgow office which is responsible for the end-to-end development of Twig’s online platform. You will be expected not only to write code, but also to provide ideas and expertise to shape new and existing products.
The Tech Team is a tight-knit, cross discipline team of people who are passionate about building great online products. Everyone gets involved in steering what we do, providing ideas for future development and opinions on which technologies we use. The ideal candidate will bring energy, expertise, creativity and innovation to the team, as well as a real pride in their work. A good sense of humour is essential.
Twig World is looking to recruit a highly skilled and motivated Python developer to build and maintain our portfolio of award-winning educational online products.
The successful candidate will be joining a small, collaborative team in our Glasgow office which is responsible for the end-to-end development of Twig’s online platform. You will be expected not only to write code, but also to provide ideas and expertise to shape new and existing products.
The Tech Team is a tight-knit, cross discipline team of people who are passionate about building great online products. Everyone gets involved in steering what we do, providing ideas for future development and opinions on which technologies we use. The ideal candidate will bring energy, expertise, creativity and innovation to the team, as well as a real pride in their work. A good sense of humour is essential.
DROP FUNCTION IF EXISTS coldesc(); | |
CREATE FUNCTION coldesc() RETURNS TABLE(COL text,VAL text) AS $$ | |
DECLARE | |
COL text; | |
Q text; | |
BEGIN | |
Q := 'SELECT ''boundary'' as COL, boundary AS VAL FROM planet_osm_line GROUP BY boundary'; | |
FOREACH COL IN ARRAY ARRAY['barrier', 'bicycle', 'bridge', 'boundary', 'building', 'construction'] | |
LOOP | |
RAISE NOTICE '%', Q; |
class ModelTest(TestCase): | |
def test_lookup(self): | |
# No articles are in the system yet. | |
self.assertQuerysetEqual(Article.objects.all(), []) | |
# Create an Article. | |
a = Article( | |
id=None, | |
headline='Area man programs in Python', |
# Theirs: | |
print map(lambda x: x * 2, range(1,11)) | |
# Mine: | |
print [x*2 for x in range(1,11)] |
bdate = BookingDate( | |
booking_name=request.user, | |
date_available=datetime.datetime.now()) | |
bdate.save() |