Skip to content

Instantly share code, notes, and snippets.

View averrin's full-sized avatar
🇨🇿
Looking for new home

Averrin averrin

🇨🇿
Looking for new home
View GitHub Profile
@render_to('sro2/journal/journal.html')
def journal_ng_obj(request,ctype,obj_id,start_date='',end_date=''):
if start_date and end_date:
#если даты переданы, то созадаем из них объекты datetime
day,mounth,year = start_date.split('.')
eday,emounth,eyear = end_date.split('.')
sd=date(int(year), int(mounth), int(day))
ed=date(int(eyear), int(emounth), int(eday)+1)
else:
@averrin
averrin / ver.py
Created April 26, 2011 10:25
ver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Change project version
__author__ = 'Averrin'
__version__ = '0.2'
path='config/main.cfg'
@averrin
averrin / gist:990485
Created May 25, 2011 07:04
config.fish
function fish_prompt -d "Write out the prompt"
set tt (math (random)/5000)
switch tt
case 0
set tt green
case 1
set tt red
case 2
set tt yellow
=== modified file 'src/core/config.py'
--- src/core/config.py 2011-06-10 19:03:28 +0000
+++ src/core/config.py 2011-07-01 13:21:35 +0000
@@ -212,6 +212,7 @@
Config.__init__ (self, fname, readonly)
self.typeOption = StringOption (self, PageConfig.sectionName, u"type", u"")
+ self.templateOption = StringOption (self, PageConfig.sectionName, u"template", u"")
self.orderOption = IntegerOption (self, PageConfig.sectionName, PageConfig.orderParamName, -1)
self.lastViewedPageOption = StringOption (self,u"History", u"LastViewedPage", u"")
@averrin
averrin / gist:1064827
Created July 5, 2011 13:25
outwiker.templates
=== modified file 'src/pages/html/HtmlPanel.py'
--- src/pages/html/HtmlPanel.py 2011-06-14 17:44:58 +0000
+++ src/pages/html/HtmlPanel.py 2011-07-05 13:21:23 +0000
@@ -18,7 +18,7 @@
from gui.htmlrenderfactory import getHtmlRender
from gui.HtmlTextEditor import HtmlTextEditor
from core.system import getTemplatesDir
-
+from core.recent import RecentWiki
@averrin
averrin / gist:1071676
Created July 8, 2011 11:53
WinterPlugins
class WinterPM(object):
"""""
Plugin manager
"""""
def activate(self, plugin):
"""""
Activate plugin
"""""
try:
@averrin
averrin / gist:1071843
Created July 8, 2011 13:38
Custom panel buttons
try:
import config
buttons=config.Config(file(os.path.expanduser('~/.outwiker/panel.cfg'))).buttons
for btn in buttons:
self._addTool (self.pageToolsMenu,
btn.id,
lambda event: self.codeEditor.turnText (btn.prefix, btn.postfix),
_(btn.hint1),
_(btn.hint2),
os.path.join (self.imagesDir, btn.icon))
@averrin
averrin / gist:1077936
Created July 12, 2011 13:05
outwiker+instapaper
import urllib, urllib2
import wx, re
def add_link(editor):
dlg = wx.TextEntryDialog(None, "Instapaper",'Insert URL')
if dlg.ShowModal() == wx.ID_OK:
response = dlg.GetValue()
launch='<script>window.onload = function(){loadDefaults(); _width += 240; saveFont(); return false;};</script>'
if re.match('(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?',response):
@averrin
averrin / gist:1263908
Created October 5, 2011 08:00
buildings
id name is_myself
----- ----------------------------------------- ------------
3241 Коммуны 26 корп 1 1
4011 Революции 29 1
4014 Революции 33 корп 3 1
4016 Революции 33 корп 5 1
4018 Революции 45 1
4020 Энгельса 129 1
4022 Энгельса 131 корп 2 1
4024 Энгельса 139 1
@averrin
averrin / gist:1351073
Created November 9, 2011 10:36
Averrin subscriptions in Google Reader
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Averrin subscriptions in Google Reader</title>
</head>
<body>
<outline title="Eng" text="Eng">
<outline text="Android Phone Fans"
title="Android Phone Fans" type="rss"
xmlUrl="http://phandroid.com/feed/" htmlUrl="http://phandroid.com"/>