This file contains 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
if(!window.assert) { | |
window.assert = function() { | |
if(!arguments.length || arguments < 2) { | |
alert('Invalid assert, use assert(expression, message1, message2, ...)') | |
return | |
} | |
var expression = arguments[0] | |
if(!expression) { | |
var message = '' | |
for(i = 1; i < arguments.length; i++) message += ' ' + arguments[i] |
This file contains 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
map.mapTypes.set("OSM", new google.maps.ImageMapType({ | |
getTileUrl: function(coord, zoom) { | |
var imagesPerUnit = Math.pow(2, zoom); | |
// Stitch horizontaly: | |
var x = coord.x < 0 ? imagesPerUnit + (coord.x % imagesPerUnit) : coord.x; | |
var x = x >= imagesPerUnit ? 0 : x; | |
// Do not stitch verticaly, if overflow -- don't show: | |
if(coord.y < 0 || coord.y >= imagesPerUnit) |
This file contains 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
#include <X11/Xlib.h> | |
#include <X11/Xutil.h> | |
#include <X11/Xatom.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
void print_window_properties(Display *display, Window *window) { | |
char *window_name; | |
int pid; | |
{ |
This file contains 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
^(?!(str1)|(str2)|(str3)|(str4)).*$ |
This file contains 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
# -*- coding: utf-8 -*- | |
import logging as mod_logging | |
import cartesius.main as mod_cartesius | |
import cartesius.charts as mod_charts | |
import cartesius.colors as mod_colors | |
import srtm as mod_srtm | |
import gpxpy.geo as mod_geo | |
mod_logging.basicConfig(level=mod_logging.DEBUG, |
This file contains 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
import sys | |
from django.conf import settings | |
from django.conf.urls import patterns | |
from django.http import HttpResponse | |
from django.core.management import execute_from_command_line | |
settings.configure( | |
DEBUG=True, | |
SECRET_KEY='trla_baba_lan', |
This file contains 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
<VirtualHost *:80> | |
ServerName mysite.com | |
#ServerAlias ... | |
ServerAdmin [email protected] | |
DocumentRoot .../projects/mysite | |
#Alias /robots.txt .../projects/qreminder-on-email/static/robots.txt | |
#Alias /favicon.ico .../projects/qreminder-on-email/static/favicon.ico |
This file contains 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
# Dummy model: | |
class DbCounter(models.Model): | |
count = models.IntegerField() | |
def get_count(table, where): | |
# Check strings for sql injections here before doing this! | |
return DbCounter.objects.raw('select 1 as id, count(*) as count from %s where %s' % (table, where))[0].count | |
# View: | |
def index(request): |
This file contains 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
# -*- coding: utf-8 -*- | |
import unicodedata as mod_unicodedata | |
all_unicode = ''.join(unichr(i) for i in xrange(65536)) | |
UNICODE_LETTERS = ''.join(c for c in all_unicode if mod_unicodedata.category(c)=='Lu' or mod_unicodedata.category(c)=='Ll') | |
UNICODE_LETTERS_AND_NUMBERS = '1234567890' + UNICODE_LETTERS | |
def extract_unicode_words(text, allowed_chars=None): | |
if text.__class__ != unicode: |
OlderNewer