This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#EXAMPLE $ vert -d res/drawable-mdpi -d res/drawable-hdpi res/drawable-xhdpi-v14/*.png | |
alias vert='python ~/git/android_tools/drawable_convert.py' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import argparse | |
import os | |
import re | |
''' | |
A simple script to create lower-resolution Android drawables from higher-resolution ones. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//really rough and needs some cleaning | |
twitter: function(){ | |
var tweets = sessionStorage.getItem('tweets'); | |
function formatTweets(data){ | |
var link = '', | |
linkRegex = /(https?:\/\/.*?)[.!?;,]?(\s+|"|$)/; | |
for (var i=6; i<data.length; i++){ | |
if (data[i].text.match(linkRegex)){ | |
link = data[i].text.match(linkRegex)[0]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TableLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<TableRow> | |
<TextView | |
android:layout_column="1" | |
android:text="•"></TextView> | |
<TextView | |
android:layout_column="2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`for f in ~/.android/avd/*.avd/config.ini; do echo 'hw.keyboard=yes' >> "$f"; done` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.db.models import Manager | |
from django.db.models.query import QuerySet | |
class CaseInsensitiveQuerySet(QuerySet): | |
def _filter_or_exclude(self, mapper, *args, **kwargs): | |
# 'name' is a field in your Model whose lookups you want case-insensitive by default | |
if 'name' in kwargs: | |
kwargs['name__iexact'] = kwargs['name'] | |
del kwargs['name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias json='python -mjson.tool' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//not very pretty | |
var dateFuture = new Date(2012,5,2,0,00,00); | |
function GetCount(ddate,iid){ | |
var dateNow = new Date(), | |
amount = ddate.getTime() - dateNow.getTime(), | |
days, | |
hours, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a method to create lists in our table | |
private Agency createAgency(String name){ | |
//create agency | |
Agency agency = new Agency(); | |
//set the name of the agency | |
agency.setName(name); | |
//create it though our DAO (put it on the database) | |
dao.create(agency); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#generate hyde (old version https://github.com/lakshmivyas/hyde) site, deploy, and also watch files for changes. | |
#This takes a path argument, for example 'hydeploy ~/this/is/where/my/site/is/located' will | |
#spin up a server, and generate a static site in '~/this/is/where/my/site/is/located/deploy' | |
hydeploy(){ | |
to=$1 | |
hy='python ~/git/hyde/hyde.py' | |
hy --generate -s ${to} -d ${to}/deploy/ -k | |
} |