start new:
tmux
start new with session name:
tmux new -s myname
from PyQt4 import QtGui, QtCore, uic | |
def p(x): | |
print x | |
class MainWindow(QtGui.QMainWindow): | |
def __init__(self): | |
QtGui.QWidget.__init__(self) | |
uic.loadUi('redirect.ui', self) |
// The progress bar in article titles. | |
// Only do this on article pages. | |
if($('#page').hasClass('article')){ | |
$('#title-progress-bar-container').tnrProgressBar({ maxWidthElement: $('#main') }); | |
// The sticky header progress bar. | |
if($(window).width() == $('#fixed-header').width()){ // iPhone mode is full width. | |
$('#fixed-header-progress-bar-container').tnrProgressBar({ | |
maxWidthOffset: -3, | |
maxWidthElement: $(window) | |
}); |
""" | |
Simple demonstration of how to implement Server-sent events (SSE) in Python | |
using Bottle micro web-framework. | |
SSE require asynchronous request handling, but it's tricky with WSGI. One way | |
to achieve that is to use gevent library as shown here. | |
Usage: just start the script and open http://localhost:8080/ in your browser. | |
Based on: |
(function(window){var i,$sound,$buttonGroup;var $sounds=$(".sound");var clientId=require("config").get("client_id");var oauthToken=require("lib/connect").getAuthToken();var conversionHelper=require("lib/helpers/conversion-helper");var $downloadButton,size;var params,downloadUrl,onSuccess;for(i=$sounds.length-1;i>=0;i--){$sound=$($sounds[i]);var soundcloudUrl="https://soundcloud.com"+($sound.find(".soundTitle__title").attr("href")||window.location.pathname);params={url:soundcloudUrl,client_id:clientId};onSuccess=function($sound){return function(data){var params={client_id:clientId};downloadUrl=require("lib/url").stringify({query:params},data.stream_url+".mp3");$buttonGroup=$($sound.find(".sound__soundActions .sc-button-group")[0]);size=$buttonGroup.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1];$downloadButton=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+conversionHelper.bytesToMB(data.origi |
(function(d) { | |
var dl = d.createElement('a'); | |
dl.innerText = 'Download MP3'; | |
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
dl.download = d.querySelector('em').innerText+".mp3"; | |
d.querySelector('.primary').appendChild(dl); | |
dl.style.marginLeft = '10px'; | |
dl.style.color = 'red'; | |
dl.style.fontWeight = 700; | |
})(document); |