Skip to content

Instantly share code, notes, and snippets.

{% with path=request.path %}
<li{% ifequal path '/' %} class="current"{% endifequal %}><a href="/">Home</a></li>
<li{% ifequal path '/about/' %} class="current"{% endifequal %}><a href="/about/">About</a></li>
{% endwith %}
{% comment %}
templates/base.html
{% endcomment %}
{% load menu_tags %}
{% main_menu %} {# This line renders the menu #}
{
"default": "61.221.43.43",
"databases": {
"61.221.43.43": {
"driver": "QMYSQL",
"address": "61.221.43.43",
"username": "__USERNAME_HERE__",
"password": "__PASSWORD_HERE__"
},
"192.168.1.121": {
@uranusjr
uranusjr / qxtglobalshortcut_mac.cpp.diff
Last active December 19, 2015 21:18
Patch to apply commit bf1b377 (old hg rev) to qxtglobalshortcut_mac.cpp for libqxt 0.6.2, fixing #50 (http://dev.libqxt.org/libqxt-old-hg/issue/50/). Generated with hg diff src/gui/qxtglobalshortcut_mac.cpp -r 3d7b209:bf1b377
diff -r 3d7b209ee18c -r bf1b3772b917 src/gui/qxtglobalshortcut_mac.cpp
--- a/src/gui/qxtglobalshortcut_mac.cpp Mon May 10 22:40:42 2010 +0300
+++ b/src/gui/qxtglobalshortcut_mac.cpp Wed Nov 17 17:28:04 2010 +0200
@@ -69,63 +69,118 @@
{
UTF16Char ch;
// Constants found in NSEvent.h from AppKit.framework
- if (key == Qt::Key_Up) ch = 0xF700;
- else if (key == Qt::Key_Down) ch = 0xF701;
- else if (key == Qt::Key_Left) ch = 0xF702;
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class KeyListener(QObject):
def eventFilter(self, obj, event):
if event.type() == QEvent.KeyPress:
if event.key() == Qt.Key_Control:
print('Control pressed')

The Legend of Tsuyoshi Shinjo

  • Tsuyoshi Shinjo (SHINJO)

    • Affliated High School of Hishi-Nippon Junior College
    • Hanshin Tigers
    • Mets
    • Giants
#!/usr/bin/env python
# -*- coding: utf-8
import os
from threading import Timer
last_file = None
@uranusjr
uranusjr / configure.diff
Created February 13, 2014 08:27
Patch to remove hard-coded OS X build spec inside the configure script. Homebrew's Qt uses either unsupported-macx-clang-libc++ (Mavericks) or unsupported-macx-clang (10.8 and earlier). Both are find as default, while macx-g++ is not.
diff --git a/configure b/configure
index a1e1f5e..9d5d6e0 100755
--- a/configure
+++ b/configure
@@ -12,7 +12,6 @@ QXT_MODULES="docs berkeley core designer gui network sql web zeroconf"
if uname -a | grep -iq Darwin; then
QXT_MAC=1
DEFAULT_LIBS="/Library/Frameworks"
- QMAKE_PARAMS="-spec macx-g++"
NO_XRANDR=1
@uranusjr
uranusjr / answer.m
Last active September 25, 2019 08:33
Sample implementation of an Objective-C class without Foundation framework.
#import <stdio.h>
#import <stdlib.h>
#import <objc/runtime.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-root-class"
#pragma clang diagnostic ignored "-Wdeprecated-objc-isa-usage"
@interface Answer
{
@uranusjr
uranusjr / django-tutorial-proposal.txt
Created June 20, 2014 13:51
Django Tutorial Proposal
TITLE: 手把手學 Django
Django 是什麼?
Short Version (不是一節)
Python
Django 的歷史
現在的 Django
我應該學 Django 嗎?
先行技能
Command line 使用技能