Skip to content

Instantly share code, notes, and snippets.

@ssendeavour
ssendeavour / copy-recursively.cpp
Created November 5, 2013 19:28
Copy file and directories recursively in Qt
//https://qt.gitorious.org/qt-creator/qt-creator/source/1a37da73abb60ad06b7e33983ca51b266be5910e:src/app/main.cpp#L13-189
// taken from utils/fileutils.cpp. We can not use utils here since that depends app_version.h.
static bool copyRecursively(const QString &srcFilePath,
const QString &tgtFilePath)
{
QFileInfo srcFileInfo(srcFilePath);
if (srcFileInfo.isDir()) {
QDir targetDir(tgtFilePath);
targetDir.cdUp();
if (!targetDir.mkdir(QFileInfo(tgtFilePath).fileName()))
@Softsapiens
Softsapiens / builder.sh
Created July 27, 2018 09:17 — forked from jefdaj/builder.sh
Draft nix expression to wrap debian packages.
source $stdenv/setup
PATH=$dpkg/bin:$PATH
dpkg -x $src unpacked
cp -r unpacked/* $out/

General

Search paths & namepaces

NIX_PATH only of the form: nixpkgs=https://nixos.org…:mypkgs=/home/bar/nixpkgs

then: nix install nixpkgs.pkgs.hello

and nix install mypkgs.pkgs.hello

@danieloneill
danieloneill / OtherComponent.qml
Created November 22, 2017 07:41
Qml Reloading technique
import QtQuick 2.7
Item {
Loader {
id: multilevelLoader
anchors.fill: parent
property string sourceUrl: 'ThirdComponent.qml'
function reload()
{
source = sourceUrl + '?' + loader.counter;
/*
* == Altered ==
* assign() is overloaded in c++. Changed assign(n, u) to
* assign_val(n, u);
*
* The insert and erase function use index instead of iterator
* to determine where stuff is inserted/erased
*
* == Not implemented ==
* any operator overloading, obviously
/*
* systray.c - systray handling
*
* Copyright © 2008-2009 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@chergert
chergert / dropline-status-icon.c
Created October 24, 2012 00:41
example for status icon
#include "dropline-status-icon.h"
G_DEFINE_TYPE(DroplineStatusIcon, dropline_status_icon, GTK_TYPE_STATUS_ICON)
struct _DroplineStatusIconPrivate
{
/*
* XXX: Put stuff you need during runtime here.
*/
gpointer dummy;
@davidboy
davidboy / app_indicator.c
Created June 24, 2011 17:18
Awsum C niceness!
#include <gtk/gtk.h>
#include <libappindicator/app-indicator.h>
int main (int argc, char **argv) {
gtk_init(&argc, &argv);
GtkWidget *menu;
GtkWidget *menu_item;
AppIndicator *indicator;
@phaustin
phaustin / qwebpage.py
Created November 17, 2016 23:14
qt web scraper
#http://stackoverflow.com/questions/21274865/scrape-multiple-urls-using-qwebpage
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
class WebPage(QtWebKit.QWebPage):
def __init__(self):
super(WebPage, self).__init__()
self.mainFrame().loadFinished.connect(self.handleLoadFinished)
def start(self, urls):
public class VerticalTimelineDecoration extends RecyclerView.ItemDecoration {
Paint paintFill = null;
Paint paintStrokeFill = null;
Paint paintStroke = null;
Paint paintDotLine = null;
Paint paintText=null;
Paint paintTextBold=null;