Skip to content

Instantly share code, notes, and snippets.

View tuxcanfly's full-sized avatar
🏠
Working from home

Javed Khan tuxcanfly

🏠
Working from home
View GitHub Profile
@tuxcanfly
tuxcanfly / appdelegate.m
Created September 9, 2011 11:29
App delegate to copy sqlite database for iOS app
-(void) checkAndCreateDatabase{
// Check if the SQL database has already been saved to the users
// phone, if not then copy it over
BOOL success;
// Create a FileManager object, we will use this to check the status
// of the database and to copy it over if required
NSFileManager *fileManager = [NSFileManager defaultManager];
// Check if the database has already been created in the users
// filesystem
success = [fileManager fileExistsAtPath:databasePath];
@tuxcanfly
tuxcanfly / DatabaseHelper.java
Created September 2, 2011 12:52
Database helper for websql android applications
package com.buddyg3.android;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.content.Context;
import android.database.SQLException;
@tuxcanfly
tuxcanfly / sencha-webdb-example.js
Created August 16, 2011 10:43
Sencha touch proxy for web database: Example
Ext.regModel('Person', {
fields: [
{name: 'name', type: 'string'},
{name: 'age', type: 'int'},
{name: 'phone', type: 'string'},
{name: 'alive', type: 'boolean', defaultValue: true}
],
proxy: {
type: 'websqlproxy',
@tuxcanfly
tuxcanfly / Ext.data.proxy.WebDB.js
Created August 16, 2011 10:36
Sencha touch proxy for web database
/**
* @author Grgur Grisogono
*
* WebSQL proxy connects models and stores to local WebSQL database.
*
* WebSQL is only available in Chrome and Safari at the moment.
*
* Version: 0.11
*
* TODO: respect sorters, filters, start and limit options on the Operation; failover option for remote proxies, ..
@tuxcanfly
tuxcanfly / ptags.py
Created June 15, 2011 08:07
Generate python tags for vim
#! /usr/bin/env python
# ptags
#
# Create a tags file for Python programs, usable with vi.
# Tagged are:
# - functions (even inside other defs or classes)
# - classes
# - filenames
# Warns about files it cannot open.
@tuxcanfly
tuxcanfly / map
Created March 18, 2011 13:23
Agiliq on google map
<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="/apis/maps/include/yt_rotator.js"></script>
#!/usr/bin/env python
###
#Everything in between these three hashes is executed only in python
# make console.log print stuff
from __future__ import print_function
class console:
log = print
@tuxcanfly
tuxcanfly / kupfer-blog-post.md
Created October 17, 2010 17:09
Kupfer, now with empathy plugin

Kupfer

Kupfer is an awesome little program much like quiicksilver for mac. Plus, its in python.

So, it was missing a plugin for empathy and I set out to write one. Also relevant

Long story short, it's up and working.

More screenshots:

# markup settings
from markupfield.markup import DEFAULT_MARKUP_TYPES
MARKUP_RENDERERS = DEFAULT_MARKUP_TYPES
DEFAULT_MARKUP_TYPE = "plain"