Skip to content

Instantly share code, notes, and snippets.

View vivainio's full-sized avatar

Ville Vainio vivainio

View GitHub Profile
Connections {
target: screen.windowState
onViewModeChanged: {
if (screen.windowState.viewModeString ==
"Fullsize") {
…foreground UI…
} else {
…background UI…
}
}
drop table if exists blobs;
CREATE TABLE blobs (
id INTEGER PRIMARY KEY,
format INTEGER,
data BLOB
);
drop table if exists nodes;
@vivainio
vivainio / gist:2219552
Created March 27, 2012 19:34
Leo slow syntax highlight
profiling to C:\b\leo-editor\leoProfile.txt
bigdash init
** isPython3: False
Leo 4.9.1 devel, build 5138, 2012-03-14 22:28:48
Python 2.7.2, qt version 4.8.0
Windows 6, 1, 7600, 2,
reading settings in C:\b\leo-editor\leo\config\leoSettings.leo
reading settings in C:\Users\v6vainio\.leo\myLeoSettings.leo
reading settings in C:\Users\v6vainio\.leo\workbook.leo
class MiniOrm
constructor: (name, size)->
size ?= 500000
@db = Sql.openDatabaseSync(name, "1.0", "QMLStorage_"+name, size)
@ensure_db()
ensure_db: ->
schema = "CREATE TABLE IF NOT EXISTS elems(type TEXT NOT NULL, key TEXT NOT NULL, value TEXT)"
@vivainio
vivainio / gist:2517158
Created April 28, 2012 08:31
Leo notebook launch
from PyQt4.QtCore import QUrl, QObject
from PyQt4.QtDeclarative import QDeclarativeView
import leo.core.leoqwrappers
reload(leo.core.leoqwrappers)
from leo.core.leoqwrappers import *
class NbController:
def __init__(self):
from PyQt4.QtCore import QUrl, QObject
from PyQt4.QtDeclarative import QDeclarativeView
from PyQt4.QtGui import QStandardItemModel,QStandardItem
class ModelWrapper:
def __init__(self, fieldlist):
self.rolenames = rn = {}
self.roleids = ri = {}
for n,f in enumerate(fieldlist):
// QmlFactory.qml
import QtQuick 2.0
import QtJsonDb 1.0 as JsonDb
Item {
property Component partition : Component {
JsonDb.Partition {
}
Raw java
---------
f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
ComponentGroup buttonGroup = new ComponentGroup();
Label buttonLabel = new Label("Buttons");
buttonLabel.setUIID("TitleLabel");
f.addComponent(buttonLabel);
final Button left = new Button("Left Alignment");
@vivainio
vivainio / gist:3720463
Created September 14, 2012 07:19
YAML as QML-lite

YAML as QML lite

LWUIT is a more modern way to compose UI's for J2ME devices. It follows the "swing" / QWidget programming style (imperatively constructing the UI tree), which is easy to learn but tedious to write and especially to read / iterate on.

It looks like this

        f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        ComponentGroup buttonGroup = new ComponentGroup();
@vivainio
vivainio / gist:3777959
Created September 24, 2012 19:53
edge animate filelist
PS C:\Program Files (x86)\Adobe\Adobe Edge Animate> ls
Directory: C:\Program Files (x86)\Adobe\Adobe Edge Animate
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 24.9.2012 22:44 AMT
d---- 24.9.2012 22:44 cef