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
__author__ = 'breddels' | |
""" | |
Demonstrates combining Qt and tornado, both which want to have their own event loop. | |
The solution is to run tornado in a thread, the issue is that callbacks will then also be executed in this thread, and Qt doesn't like that. | |
To fix this, I show how to use execute the callback in the main thread, using a Qt signal/event in combination with Promises. | |
The output of the program is: | |
fetch page, we are in thread <_MainThread(MainThread, started 47200787479520)> | |
response is 191548 bytes, we are in thread <Thread(Thread-1, started daemon 47201018689280)> | |
the other thread should fulfil the result to this promise, we are in thread <Thread(Thread-1, started daemon 47201018689280)> |
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
var bodyRect = document.body.getBoundingClientRect(), | |
elemRect = document.getElementById('keroro').getBoundingClientRect(), | |
offset = elemRect.top - bodyRect.top; | |
alert('Element is ' + offset + ' vertical pixels from <body>'); |
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
$('[data-ajax=modal]').each(function(index, el) { | |
var this_el = $(this); | |
var form_el = $('form', this_el); | |
this_el.on('hide.bs.modal', function(){ | |
var next_el = $('.modal-header', this_el).next(); | |
if( next_el.hasClass('alert') ) | |
next_el.remove(); |
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
$('#uploadLogo').click(function(e) { | |
e.preventDefault(); | |
//If the uploader object has already been created, reopen the dialog | |
if (custom_uploader) { | |
custom_uploader.open(); | |
return; | |
} | |
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
/************************************************************** | |
:: Line Splitters | |
.splitter | |
.dotted | |
.dotted-middle | |
**************************************************************/ | |
.splitter { |
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
a { | |
position: relative; | |
text-decoration: none; | |
&:after { | |
position: absolute; | |
width: 100%; | |
bottom: 0.2em; | |
border-bottom: 1px solid lighten(@text-color, 20%); | |
content: ""; | |
left: 0; |
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
img { | |
bottom: 0; | |
left: 0; | |
position: absolute; | |
right: 0; | |
margin: auto; | |
text-align: center; | |
top: 0; | |
width: auto; |
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 Talbe | |
**************************************************/ | |
.the-table { | |
display: table; | |
width: 100%; | |
} | |
.tr { |
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
.thin-icon { | |
width: 1em; | |
height: 1em; | |
position: relative; | |
display: inline-block; | |
z-index: 1; | |
&:before, &:after { | |
content: ""; | |
display: block; |
NewerOlder