Skip to content

Instantly share code, notes, and snippets.

View fecub's full-sized avatar

Ferit Cubukcuoglu fecub

View GitHub Profile
/*
Copyright (c) 2014 Cutehacks A/S
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@fecub
fecub / qbytearrayToFile.cpp
Created January 5, 2015 13:35
Write QByteArray to file or image file
QByteArray imageByteArray = blayer->TableContentRTM("Produkte")->record(pIndex.row()).value("Image").toByteArray();
QFile newDoc("/home/fecub/fileName.png");
if(newDoc.open(QIODevice::WriteOnly)){
newDoc.write(imageByteArray);
}
newDoc.close();
@fecub
fecub / keyvalues.cpp
Last active August 29, 2015 14:12
Show Record or KeyValues QRelationTableModel
//Show value
qDebug() << blayer->TableContentRTM("Produkte")->record(pIndex.row()).value("Image");
// show key Values in table
qDebug() << blayer->TableContentRTM("Produkte")->record(pIndex.row()).keyValues(blayer->TableContentRTM("Produkte")->record(pIndex.row()));
qDebug() << blayer->TableContentRTM("Produkte")->record(pIndex.row()).fieldName(6);
@fecub
fecub / qt_screenshot.cpp
Last active August 29, 2015 14:07
How to Qt screenshot
#include <QPixmap>
#include <QDir>
#include <QFileDialog>
#include <QString>
#include <QScreen>
QPixmap originalPixmap;
originalPixmap = QPixmap(); // clear image for low memory situations
// on embedded devices.
@fecub
fecub / calc.kv
Created November 4, 2013 14:04 — forked from tshirtman/calc.kv
BoxLayout:
orientation: 'vertical'
Label:
size_hint_y: None
height: '50dp'
id: calc
text: ''
GridLayout:
cols: 4
@fecub
fecub / Game.java
Last active August 27, 2020 13:44
GameDev - Jumping Algorithm
/*
Initialize the variables
--------------------------
private int jumpWidth = 0;
private boolean jumpStatus = false;
private int gravity = 2;
private int jumpPower = 5;
private boolean startJump = false;
*/
@fecub
fecub / gist:5487575
Created April 30, 2013 09:16
output complete database design
public static void outputdesign(Dictionary<string, Dictionary<string, Dictionary<string, object>>> TableDesign)
{
foreach (KeyValuePair<string, Dictionary<string, Dictionary<string, object>>> item in TableDesign)
{
Console.WriteLine(item.Key);
foreach (KeyValuePair<string, Dictionary<string, object>> item2 in item.Value)
{
foreach (KeyValuePair<string, object> item3 in item2.Value)
{
@fecub
fecub / gist:5487136
Created April 30, 2013 07:24
Iterate a list with lambda
// normal version:
foreach(var item in fKeySequence)
{
Console.WriteLine("{0}", i);
}
// elegant version:
fKeySequence.ForEach(i => Console.WriteLine("{0}", i));