This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#https://askubuntu.com/questions/833448/how-to-update-vs-code-on-ubuntu | |
wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb | |
sudo dpkg -i /tmp/code_latest_amd64.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Read a 32-bit (!) wave file and plot frequency response | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import wave | |
import sys | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QHeaderView> | |
#include <QScroller> | |
#include <QScrollBar> | |
// ... // | |
// in someWidget with someView (typical settings, not mandatory): | |
someView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
someView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | |
someView->horizontalScrollBar()->setDisabled(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "multilinetextdialog.h" | |
#include <QVBoxLayout> | |
#include <QDialogButtonBox> | |
#include <QPushButton> | |
MultilineTextDialog::MultilineTextDialog(QWidget *parent) : QDialog(parent) | |
{ | |
// allocate widgets | |
heading = new QLabel; | |
textEdit = new QTextEdit(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get timezone offset in seconds | |
int offsetSeconds = QTimeZone::systemTimeZone().offsetFromUtc(QDateTime::currentDateTime()); | |
// format an ISO Date & Time with Timezone. eg "2018-03-21T13:04:00+11:00" | |
QDateTime selectedDateTime = QDateTime(calendarWidget->selectedDate(), timeEdit->time(), Qt::OffsetFromUTC, offsetSeconds); | |
qDebug() << selectedDateTime.toString(Qt::ISODate); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef APPOINTMENTWIDGET_H | |
#define APPOINTMENTWIDGET_H | |
// AppointmentWidget.h : basic appointment (Diary) widget | |
// (implementation in header) | |
#include <QWidget> | |
#include <QStringList> | |
#include <QTime> | |
#include <QTimer> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if defined(_DEBUG) && defined(_MSC_VER) | |
// use this to trap floating-point exceptions (MSVC: compile with /fp:strict) | |
#include <float.h> | |
unsigned int fp_control_state = _controlfp(_EM_INEXACT, _MCW_EM); | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// factorial.h : table of factorial constants | |
// note: to use quad-precision with GCC, compile with | |
// -std=gnu++11 -lquadmath | |
#ifndef FACTORIAL_H | |
#define FACTORIAL_H | |
#define FACTORIAL_TABLE_DOUBLE_COUNT 60 | |
#define FACTORIAL_TABLE_QUAD_COUNT 170 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QDir dir("path/to/dir"); | |
if (!dir.exists()) { | |
dir.mkpath("."); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The trick is to call grabGesture() on the widget's viewport() instead of the whole widget itself | |
// eg: | |
// Add kinetic scroller to converter output | |
QScroller::grabGesture(ui->ConverterOutputText->viewport(), QScroller::LeftMouseButtonGesture); | |
// ... instead of | |
// QScroller::grabGesture(ui->ConverterOutputText, QScroller::LeftMouseButtonGesture); |