Skip to content

Instantly share code, notes, and snippets.

TEST(DatabaseTest, BasicTest) {
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
ASSERT_TRUE(db.open());
QSqlQuery query;
EXPECT_TRUE(query.exec("CREATE TABLE IF NOT EXISTS testtable "
"(title, url);"));
EXPECT_TRUE(query.prepare("INSERT INTO testtable (title, url) "
"VALUES (:title, :url);"));
query.bindValue(":title", "some title");
#include "onyx/screen_proxy.h"
#include "onyx/sys_status_public.h"
/// Create my own widget.
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0) : QWidget(parent) {}
~MyWidget() {}
@hjiang
hjiang / init.el
Created October 23, 2019 10:01
Smart split for Emacs
(defun smart-split ()
"Split the frame into 80-column sub-windows, and make sure no window has
fewer than 80 columns."
(interactive)
(cl-lables ((smart-split-helper (lambda (w)
(if (> (window-width w) (* 2 81))
(let ((w2 (split-window w 82 t)))
(smart-split-helper w2))))))
(smart-split-helper nil)))
#include <time.h>
#include <stdio.h>
int main() {
int i;
int j;
int k;
int a;
int b;
const int n = 100000000;