Skip to content

Instantly share code, notes, and snippets.

import QtQuick 2.4
import QtQuick.Window 2.2
import goqml 1.0
Window {
visible: true
property var roles: ["bullet", "enemyBullet", "player"]
function getRole(name)
{
@bzar
bzar / gist:b0fb12d97801ddf76c84
Last active August 29, 2015 14:16
N-dimensional hypercube single-solution maze generation algorithm with waypoints

Inputs

  • Maze dimensions as an N-vector containing size in each dimension
  • List of waypoints as N-vectors

Algorithm

  1. Define N-dimensional hypercube with given dimensions and intercell wall state
  2. Generate main path
@bzar
bzar / better.cc
Last active August 29, 2015 14:22
Muhkeimmat sanat
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#include <locale>
#include <codecvt>
#include <bitset>
{reverse, sum, empty, all, fold, concat-map, flatten, span, Obj, sort-by, head} = require 'prelude-ls'
# [[String]] -> Bool
in-order = (xss) -> all (-> it.length == 1), xss
# [[String] -> Data -> [[String]]] -> Data -> [String] -> [[String]]
order-by-one = (fs, d, xs) -->
| xs.length < 2 => [xs]
| otherwise =>
fold ((ys, f) -> if ys.length == 1 then f(ys[0], d) else ys), [xs], fs
@bzar
bzar / plugin.py
Last active January 14, 2016 09:32
import ckan.plugins as plugins
import logging
log = logging.getLogger(__name__)
def admin_only(context, data_dict=None):
return {'success': False, 'msg': 'Access restricted to system administrators'}
{reverse, sum, empty, all, fold, concat-map, flatten, span, Obj, sort-by, head} = require 'prelude-ls'
# [[String]] -> Bool
in-order = (xss) -> all (-> it.length == 1), xss
# [[String] -> Data -> [[String]]] -> Data -> [String] -> [[String]]
order-by-one = (fs, d, xs) -->
| xs.length < 2 => [xs]
| otherwise =>
fold ((ys, f) -> if ys.length == 1 then f(ys[0], d) else ys), [xs], fs
import QtQuick 2.0
Rectangle {
property color unpressedColor: "gray"
property color pressedColor: "lightgray"
property alias pressed: ma.pressed
property alias text: label.text
property real size: 1
signal clicked()
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QCursor>
#include "key_emitter.h"
#include "raspberrybacklight.h"
int main(int argc, char *argv[])
Timer {
id: backlightTimer
interval: 1000*60*5
onTriggered: backlight.state = false
running: backlight.state
repeat: false
}
gpu_mem=256
dtoverlay=vc4-kms-v3d
lcd_rotate=2