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
# Colors | |
declare -A Colors | |
Colors[black]="\[\033[0;30m\]" | |
Colors[red]="\[\033[0;31m\]" | |
Colors[green]="\[\033[0;32m\]" | |
Colors[yellow]="\[\033[0;33m\]" | |
Colors[blue]="\[\033[0;34m\]" | |
Colors[magenta]="\[\033[0;35m\]" | |
Colors[cyan]="\[\033[0;36m\]" | |
Colors[white]="\[\033[0;37m\]" |
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 import template | |
register = template.Library() | |
class GridViewNode(template.Node): | |
def __init__(self, item_template_name, objects_list): | |
self.item_template_name = item_template_name | |
self.objects_list = template.Variable(objects_list) | |
self.grid_template = template.loader.get_template('common/grid/grid-view.html') |
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.template import Library | |
from django.core.serializers import serialize | |
from django.core.serializers.json import DjangoJSONEncoder | |
from django.utils import simplejson | |
from django.utils.safestring import mark_safe | |
register = Library() | |
@register.filter |
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
[{"phonenumber": "(09) 7533 100", "name": "3. linja", "address": "Kolmas linja 6", "latitude": 60.1817299628, "tags": ["olutravintola"], "homepage": "", "longitude": 24.9509723639, "description": "Minikokoinen kivijalkapubi 3:nnella linjalla, jota Fredikin kulki takaisin. Baarissa kaksi televisiota. Halpa tuoppi."}, {"phonenumber": "(09) 343 2814", "name": "4 Vuodenaikaa", "address": "Rusthollarintie 2", "latitude": 60.2122766079, "tags": [""], "homepage": "", "longitude": 25.0960335589, "description": ""}, {"phonenumber": "0400 211 921", "name": "A21", "address": "Annankatu 21", "latitude": 60.1662143231, "tags": ["cocktail", "drinkkej\u00e4", "drinkkibaari", "juhlapaikka", "kokoustila"], "homepage": "http://www.a21.fi/", "longitude": 24.9378044239, "description": "Cocktail Lounge A21 keskittyy hyviin drinkkeihin eli ns. \"Fine Drinkingiin\". Cocktail-lista on jaettu nelj\u00e4\u00e4n kategoriaan, joiden kautta cocktailien laaja kirjo aukeaa maallikollekin. Tarjolla on makuja suomalaisesta luonnosta, kauden |
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 import forms | |
from django.conf import settings | |
from django.utils.safestring import mark_safe | |
class GoogleMapsWidget(forms.HiddenInput): | |
# Media to be includes with the widget | |
class Media: | |
js = ( |
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
latitude = forms.CharField(widget=GoogleMapsWidget(attrs={'map_width': 640, 'map_height': 480, 'longitude_id': 'id_longitude'}), | |
error_messages={'required': 'Please select a location on the map.'}, | |
label='Location' | |
) | |
longitude = forms.CharField(widget=forms.HiddenInput()) |
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
class GridBounds | |
constructor: (bounds) -> | |
this.minX = Math.min(bounds[0].x, bounds[1].x) | |
this.maxX = Math.max(bounds[0].x, bounds[1].x) | |
this.minY = Math.min(bounds[0].y, bounds[1].y) | |
this.maxY = Math.min(bounds[0].y, bounds[1].y) |
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
# Process all markers in the bounds provided, using a callback | |
processAll: (bounds, callback) -> | |
for x in [bounds.minX..bounds.maxX] | |
for y in [bounds.minY..bounds.minX] | |
"foo" | |
processAll = function(bounds, callback) { | |
var x, y, _i, _ref, _ref1, _results; | |
_results = []; |
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
# Process all markers in the bounds provided, using a callback | |
processAll: (bounds, callback) -> | |
for x in [bounds.minX..bounds.maxX] | |
for y in [bounds.minY..bounds.minX] | |
"foo" | |
processAll = function(bounds, callback) { | |
var x, y, _i, _j, _ref, _ref1, _ref2, _ref3; | |
for (x = _i = _ref = bounds.minX, _ref1 = bounds.maxX; _ref <= _ref1 ? _i <= _ref1 : _i >= _ref1; x = _ref <= _ref1 ? ++_i : --_i) { |
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
# Process all markers in the bounds provided, using a callback | |
processAll: (bounds, callback) -> | |
for x in [bounds.minX..bounds.maxX] | |
for y in [bounds.minY..bounds.minX] | |
"foo" | |
@ | |
processAll = function(bounds, callback) { | |
var x, y, _i, _j, _ref, _ref1, _ref2, _ref3; |