Skip to content

Instantly share code, notes, and snippets.

View philippbosch's full-sized avatar

Philipp Bosch philippbosch

View GitHub Profile

Keybase proof

I hereby claim:

  • I am philippbosch on github.
  • I am philippbosch (https://keybase.io/philippbosch) on keybase.
  • I have a public key whose fingerprint is 0767 102D 8645 0F7D EA0B D4FA C8DB A35E 90B0 0103

To claim this, I am signing this object:

@philippbosch
philippbosch / randomstring.py
Created December 16, 2014 11:40
Create random string in Python
import random
import string
length=10
code = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))
@philippbosch
philippbosch / .htaccess
Last active August 29, 2015 14:20 — forked from thoop/.htaccess
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@philippbosch
philippbosch / settings.py
Created February 26, 2009 14:37
django project settings templates for django-pb
from distutils.sysconfig import get_python_lib
execfile(get_python_lib() + "/pb/settings_base.py")
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
#!/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
...
<input type="text" id="username">
...
// 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);
});
<?php
if (preg_match('/Mobile/', $_SERVER['HTTP_USER_AGENT'])) {
header('Location: iphone.html');
exit;
}
?>
<!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>