Skip to content

Instantly share code, notes, and snippets.

View tbreuss's full-sized avatar
🚴‍♂️
Biking

tebe tbreuss

🚴‍♂️
Biking
View GitHub Profile
@oranja
oranja / qtcreator_autotests.md
Last active July 15, 2017 08:13
Run and monitor AutoTests in QtCreator (QTestLib)

The Qt framework offers Qt Test / QTestLib as a simple unit-testing framework for Qt-based projects. Perhaps too simple, as it comes with an annoying limitation that requires a separate executable for each test class, or creating a single test runner with a manually added call to each test suite. A quick search shows easy and helpful workarounds that offer to replace the manual work with a short #include and a macro. Then the test-runner remains untouched and finds all your test suites with these hints alone.

1]: http://qtcreator.blogspot.co.il/2009/10/running-multiple-unit-tests.html

2]: https://marcoarena.wordpress.com/2012/06/23/increase-your-qtest-productivity/

3]: https://github.com/e-j/qt-multiple-tests

In version 4.0 of QtCreator, the AutoTest plugin is made available to all, through the Community Edition of QtCreator. It offers a decent “Test Results” output pane that allows you to run and monitor th

@davelpz
davelpz / gist:1996353
Created March 7, 2012 21:27
jQuery Widget Template
# Name of Widget
# some general notes about purpose and usage
# naming convention is: ccWidgetName.coffee
# Getter and setter methods, return and chaining implications:
# There are two kinds of plugin functions: getters and setters.
@cowboy
cowboy / jquery.ba-simplewidget.js
Created October 28, 2010 19:21
jQuery simpleWidget: a super-simple stateful widget factory
/*!
* jQuery simpleWidget - v0.1pre - 10/28/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,undefined){
@mathiasprinz
mathiasprinz / clickoutside.js
Created December 20, 2011 07:52
Sample of a widget
/*!
* jQuery outside events - v1.1 - 3/16/2010
* http://benalman.com/projects/jquery-outside-events-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// Script: jQuery outside events
@seriema
seriema / jquery-widget.js
Last active August 12, 2017 13:20
A really simple widget pattern for jQuery. Personally I would recommend using Angular, Ember, React, or something else that already has a good system for this, but sometimes you don't have a choice and this simple pattern has helped me many times. You can wrap it like this: https://gist.github.com/seriema/4b3a818ce85b6ab03ddd
// This is the basic principle of a minimalistic jQuery based widget system.
// Every widget has one root element, with a unique classname prefix. Here I used "w-".
//
// First, select all those widgets on the page with $('.w-...').
// Second, iterate over all of them and work with them in a local scope.
$(function() {
$('.w-my-widget').each(function() {
// Grab the elements you need.
var $root = $(this);
var $child = $root.find('.child'); // Always use .find() from $root or a child of $root, to avoid global selectors and potential bugs with one widget affecting another.
@cpliakas
cpliakas / ant-composer.xml
Created November 26, 2013 01:20
Apache Ant tagets for Composer commands.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Composer Targets" default="build">
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>
<target name="php-check">
<condition property="php" value="php">
<not>
<isset property="${php}"/>
@tomschlick
tomschlick / Environments to bypass .htpasswd protection
Created November 8, 2009 08:30
This allows you to set certain urls/domains that are allowed to bypass a htpasswd protection layer, which is very useful for multiple environment setups (developement, staging, production)
#allows a single uri through the .htaccess password protection
SetEnvIf Request_URI "/testing_uri$" test_uri
#allows everything if its on a certain host
SetEnvIf HOST "^testing.yoursite.com" testing_url
SetEnvIf HOST "^yoursite.com" live_url
Order Deny,Allow
AuthName "Restricted Area"
AuthType Basic
@orlov0562
orlov0562 / gist:9569dce2759087e92324
Last active June 27, 2019 10:39
Exception back trace with no truncated strings
<?php
// source: http://stackoverflow.com/questions/1949345/how-can-i-get-the-full-string-of-php-s-gettraceasstring
function getExceptionTraceAsString($exception) {
$rtn = "";
$count = 0;
foreach ($exception->getTrace() as $frame) {
$args = "";
if (isset($frame['args'])) {
$args = array();
(function($){
$.widget("ui.mywidget", {
options: {
autoOpen: true
},
_create: function(){
// by default, consider this thing closed.
@rponte
rponte / log4j.properties
Created September 8, 2011 19:45
Log4j configuration example with multiple appenders
log4j.rootLogger=warn, stdout, DAILY
## Console Appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %5p [%-20c{1}] %m%n
## Daily Appender
log4j.appender.DAILY.Threshold=error
log4j.appender.DAILY=org.apache.log4j.DailyRollingFileAppender