Skip to content

Instantly share code, notes, and snippets.

@vannell
vannell / gist:86a4290b776e97045790fc8c72ab6d74
Created March 27, 2018 18:22
ASP ViewState size bookmarklet
javascript:(function(){var%20input=document.getElementById("__VIEWSTATE");if(input)alert(input.value.length+"%20bytes");})();
@vannell
vannell / sandbox.qml
Last active July 4, 2022 08:35
QML Rectangle intersection calculation
import QtQuick 2.4
Item {
id: root
width: 800
height: 600
property int xOverlap: 0
// Classes/Pcd.qml
import QtQuick 2.3
Rectangle {
color: "red"
implicitWidth: 200
implicitHeight: 200
function startPcdCall() {
console.log("startPcdCall function called...");
import QtQuick 2.3
Item {
id: root
width: 400
height: 400
Flickable {
anchors.fill: parent
contentWidth: grid.width
import QtQuick 2.3
FocusScope {
id: scope
property alias text: label.text
signal clicked()
//FocusScope needs to bind to visual properties of the children
@vannell
vannell / .bashrc
Created October 15, 2014 10:16
Bash PS1 git aware
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@vannell
vannell / downloader.cpp
Created June 29, 2014 16:12
Qt download test
#include "downloader.hpp"
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QVariant>
#include <QDebug>
Downloader::Downloader(QObject *parent) :
QObject(parent)
{
@vannell
vannell / gist:58ef3d4d2bde4aa6e584
Created June 17, 2014 12:15
C++ Static initialization
class A {
static T a;
static T initStaticA() {
T t;
//do some stuff on t
return t;
}
};
#As readlink is not available on all distro or OSX, provide a portable way to get an
#absolute path from a relative one.
make_absolute() {
local ret=false
local rel_path=$1
if [[ ! -z $rel_path ]]; then
#strip eventual last slash
rel_path=${rel_path%/}
@vannell
vannell / setup.py
Created December 13, 2013 08:51
py2exe bundling
#!/usr/bin/env python
from distutils.core import setup
import py2exe
setup(
options = {'py2exe': {'bundle_files': 1, 'compressed': True, 'dll_excludes': ['w9xpopen.exe']}},
console=['foobar.py'],
zipfile = None
)