Skip to content

Instantly share code, notes, and snippets.

@ns-1m
ns-1m / mobile_photo.js
Created April 19, 2012 04:01 — forked from pamelafox/mobile_photo.js
Getting/rotating photos in PhoneGap
function getPhoto(mealId, sourceType, saveOnSuccess) {
var $mealDiv = $('#log-meal-' + mealId);
var $mealImg = $mealDiv.find('.log-meal-photo-button img');
var $quickpicStatus = $('#mobile-quickpic-link span');
function resetQuickPicStatus() {
$quickpicStatus.html('').addClass('icon-camera');
}
@ns-1m
ns-1m / gist:2403566
Created April 17, 2012 05:03 — forked from geohacker/gist:1605407
cloudmade_layer
var map = new L.Map('map');
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/API-KEY/997/256/{z}/{x}/{y}.png',
cloudmadeAttrib = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade',
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttrib});
@ns-1m
ns-1m / gist:2403560
Created April 17, 2012 05:02 — forked from geohacker/gist:1605424
mapquest_layer
var map = new L.Map('map');
var mapquestUrl = 'http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
subDomains = ['otile1','otile2','otile3','otile4'],
mapquestAttrib = 'Data, imagery and map information provided by <a href="http://open.mapquest.co.uk" target="_blank">MapQuest</a>,
<a href="http://www.openstreetmap.org/" target="_blank">OpenStreetMap</a> and contributors.
var mapquest = new L.TileLayer(mapquestUrl, {maxZoom: 18, attribution: mapquestAttrib, subdomains: subDomains});
@ns-1m
ns-1m / django-crossdomainxhr-middleware.py
Created April 15, 2012 07:17 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@ns-1m
ns-1m / Spacedust.dvtcolortheme
Created April 15, 2012 05:59
Spacedust Xcode 4 Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
@ns-1m
ns-1m / GETfood_blog_hierarchy.json
Created April 15, 2012 03:20 — forked from jazztpt/GETfood_blog_hierarchy.json
GET request returning hierarchy of data
{
"title":"Food",
"articles":
[
{
"url":"http://oursocialbloggingsite.com/api/articles/111",
"title":"Why Food Is Delicious",
"author":"Abe Adams"
},
{
@ns-1m
ns-1m / resources.py
Created April 15, 2012 02:05 — forked from bohde/resources.py
Tastypie support for Geodjango distance filtering
class MyGeoResource(Resource):
def apply_sorting(self, objects, options=None):
if options and "longitude" in options and "latitude" in options:
return objects.distance(Point(options['latitude'], options['longitude'])).order_by('distance')
return super(MyGeoResource, self).apply_sorting(objects, options)
@ns-1m
ns-1m / Select_to_Html.js
Created April 11, 2012 01:45 — forked from cfaulkingham/Select_to_Html.js
Convert Select ELement's to Dropdown group
/*!
* Convert <select> elements to Dropdown Group
*
* Author: John Rocela 2012 <[email protected]>
* Update: Fixed issue with selected showing value instead of text Colin Faulkingham <[email protected]> 2012
*/
jQuery(function($){
$('select').each(function(i, e){
if (!($(e).data('convert') == 'no')) {
$(e).hide().wrap('<div class="btn-group" id="select-group-' + i + '" />');
config.json:
{
"database": {
"connection": "pg://postgres:[email protected]:5432/test"
},
"web": {
"port": 8000
}
}
@ns-1m
ns-1m / TileLayer.Bing.js
Created April 8, 2012 20:40 — forked from pagameba/TileLayer.Bing.js
Leaflet Bing layer
/*
* Portions of this code and logic copied from OpenLayers and
* redistributed under the original Clear BSD license terms:
*
* http://trac.osgeo.org/openlayers/browser/license.txt
*
* Copyright 2005-2010 OpenLayers Contributors, released under
* the Clear BSD license. See authors.txt for a list of contributors.
* All rights reserved.
*