Skip to content

Instantly share code, notes, and snippets.

code for food

Gianluca Pacchiella gipi

code for food
View GitHub Profile
gipi / gist:1301059
Created Oct 20, 2011
Check HTML5 storage support
View gist:1301059
// via dive into html5
function supports_local_storage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch(e){
return false;
gipi / Manifest.plist
Created Oct 21, 2011
Creating a home page to download an In House ad hoc iphone application
View Manifest.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
gipi / gist:1304734
Created Oct 21, 2011
Add screen resolution supporto to android application.
View gist:1304734
gipi /
Created Oct 24, 2011
Python functions' default value is evaluated at function definition time.
def bad_append(new_item, a_list=[]):
>>> print bad_append('one')
>>> print bad_append('two')
['one', 'two']
return a_list
gipi / gist:1316346
Created Oct 26, 2011
Simple example of facebook posting in Android
View gist:1316346
public class MyActivity extends Activity {
private Facebook mFacebook = new Facebook("0123456", R.drawable.ic_fb);
public void callFacebook(final Activity activity, final String title, final String caption, final String picURL) {
android.util.Log.i("FB", "callFacebook");
mFacebook.authorize(activity, new DialogListener() {
gipi / gist:1321981
Last active Sep 27, 2015
Pretty print #json with #python #oneliner
View gist:1321981
echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool
gipi /
Created Oct 31, 2011
Configure a Django project to use a specific database to use when run tests if we can't create databases with the user credential defined in the 'default' one
# Since we need a syncdb on all the databases, before the tests can be
# runned successfully we need to execute
# $ python syncdb
# $ python syncdb --database=test
# otherwise will be errors like
# 'django.db.utils.DatabaseError: no such table: django_site'
gipi / gist:1330214
Last active Sep 7, 2018
Create a #gstreamer pipeline to use with #skype
View gist:1330214
# to use with v4l2loopback module
gst-launch -v videotestsrc ! "video/x-raw-yuv,width=640,height=480,framerate=30/1,format=(fourcc)UYVY" ! v4l2sink device=/dev/video1
gipi / gist:1330564
Last active Sep 27, 2015
Domain dependent web root directory in #nginx. Need version 0.7.40
View gist:1330564
server {
listen 80; ## listen for ipv4
# if we have www.miao.bau then the variables defined from
# the regex are $1 = www and $2 = miao.bau
server_name localhost ~^(www\.)?(.+)$;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/$2;