Skip to content

Instantly share code, notes, and snippets.

Avatar

Philipp Bosch philippbosch

View GitHub Profile
@philippbosch
philippbosch / settings.py
Created Feb 26, 2009
django project settings templates for django-pb
View settings.py
from distutils.sysconfig import get_python_lib
execfile(get_python_lib() + "/pb/settings_base.py")
View new django project
read -p "Project name? " PROJECT_NAME
django-admin.py startproject $PROJECT_NAME
mysqladmin5 -uroot --default-character-set=utf8 create $PROJECT_NAME
cd $PROJECT_NAME
chmod +x manage.py
mkdir migrations
mkdir templates
mkdir media
mkdir media/img
mkdir media/css
View twittertrend.py
#!/usr/bin/env python
# encoding: utf-8
"""
twittertrend.py
Created by Philipp Bosch on 2010-03-23.
Copyleft (ɔ) 2010 Philipp Bosch. No rights reserved.
"""
import sys
View get.js
// Get that document
people.get(me.key, function(r){
console.log(r);
});
// Returns all documents as an array to a callback
people.all(function(r){
console.log(r);
});
View mobile-detection.php
<?php
if (preg_match('/Mobile/', $_SERVER['HTTP_USER_AGENT'])) {
header('Location: iphone.html');
exit;
}
?>
View phonegap-device.html
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap Device Information</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jqtouch.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js"></script>
View phonegap-notifications.html
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=default-width; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap Notifications</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="jqtouch/jqtouch.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js"></script>
View UIControls.m
//
// UIControls.m
// PhoneGap
//
// Created by Michael Nachbaur on 13/04/09.
// Copyright 2009 Decaf Ninja Software. All rights reserved.
//
#import "UIControls.h"
View sample-with-transition.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
font-family: Helvetica;
}
#elem {