Skip to content

Instantly share code, notes, and snippets.

View Kakadu's full-sized avatar

Dmitrii Kosarev Kakadu

  • (ex-)JetBrains Research
  • Saint-Petersburg, Russia
View GitHub Profile
kakadu:/media/disk/kakadu/prog/ocaml/ocsigen$ git clone git@github.com:pcouderc/ocp-webedit.git ocp-webedit3
Cloning into 'ocp-webedit3'...
remote: Counting objects: 1229, done.
remote: Compressing objects: 100% (543/543), done.
remote: Total 1229 (delta 702), reused 1184 (delta 657)
Receiving objects: 100% (1229/1229), 4.91 MiB | 131.00 KiB/s, done.
Resolving deltas: 100% (702/702), done.
Checking connectivity... done
@Kakadu
Kakadu / scroll.qml
Created September 9, 2013 15:13
ScrollView inside ScrollView doesn't get mouse wheel event.
import QtQuick 2.0
import QtQuick.Controls 1.0
Rectangle {
width: 800
height: 600
ScrollView {
anchors.fill: parent
@Kakadu
Kakadu / concat.cpp
Created September 19, 2013 11:12
C++ dependent types array concat
//g++ -std=c++11 a.cpp
#include <array>
template <typename T, size_t a, size_t b>
std::array<T, a + b> concat(std::array<T, a> const& x, std::array<T, b> const& y) {
std::array<T, a + b> z;
std::copy(x.begin(), x.end(), z.begin());
std::copy(y.begin(), y.end(), z.begin() + x.size());
return z;
}
@Kakadu
Kakadu / main.cpp
Created October 28, 2013 09:11
QtQuick demo about signal in QML and slot in C++
#include <QtGui/QGuiApplication>
#include "signalslotlistview.h"
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickView>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView *view = new QQuickView();
@Kakadu
Kakadu / PanelButton.qml
Created February 1, 2014 21:14
QtQuick 2.0 list of buttons with onClicked handlers
import QtQuick 2.0
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
height: 20
radius: 10
border.width: 1
property string title
color: "lightgray"
@Kakadu
Kakadu / ListItem.qml
Created February 8, 2014 18:57
ListView for buttons with custom onclick events. In this implementation button onclick handler is placed in model near to useful properties of button. I don't want to place them far away of button descriptions because it breaks readability.
import QtQuick 2.0
Rectangle {
id: root
anchors { left: parent.left; right: parent.right }
height: 30
color: "gray"
radius: 15
border.width: 1
@Kakadu
Kakadu / 1.qml
Last active August 29, 2015 13:56
The 2nd variant is 100% correct implementation. But it introduces dummy identifier which creation I want ot avoid. 1st peice of code is about avoiding it. I dont introduce variable there, I set property value to VisualListItem explicitly. It seems to work correctly but QtCreator's syntax highlighter doesn't understand it as expected. Am I missin…
Item {
property variant forestQuest1: _forestQuest1
Rectangle {
id: _forestQuest1
property variant choices: VisualItemModel {
id: _forest1_choices
QuestButton { ... }
open Eliom_openid
open Lwt
let messages =
let scope = (Eliom_common.default_process_scope :> Eliom_common.user_scope) in
Eliom_state.create_volatile_table ~scope ()
(* The login form *)
let login_form = Eliom_service.App.service
~path:["login-form"]
@Kakadu
Kakadu / Root.qml
Last active August 29, 2015 13:58
Expected: City1____ and City1____. Got: City1____ and undefined. Why when strict mode is enabled eval("images.city1") is evaluated by QML JS engine into undefined? Plain javascript object are evaluated OK (not into undefined).
import QtQuick 2.1
import "global.js" as Global
import "ocaml.js" as OCaml
Rectangle {
width: 1224; height: 600; color: "lightgray";
Item { id: images; visible: false
property string city1: "City1____"
@Kakadu
Kakadu / a.qml
Created June 4, 2014 08:20
QtQuick attached signal Add example
import QtQuick 2.1
Rectangle {
width: 800; height: 600
ListModel {
id: nameModel
ListElement { name: "Alice" }
ListElement { name: "Bob" }