Skip to content

Instantly share code, notes, and snippets.

View denysonique's full-sized avatar

Dennis Prochniak denysonique

View GitHub Profile
Failures:
1) Signed in user should sign in successfully
Failure/Error: current_path.should eq('/profile')
expected "/profile"
got "/users/sign_in"
(compared using ==)
# ./spec/requests/user_home_spec.rb:18:in `block (2 levels) in <top (required)>'
require 'eventmachine'
require 'Qt4'
require 'emdrb'
require './client_ui'
$time_remaining ||= Time.new(0,1,1,1)
$time_used ||= Time.new(0)
class ClientController
def initialize
$ ruby client.rb
/home/dennis/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/thread.rb:185:in `sleep': deadlock detected (fatal)
from /home/dennis/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/thread.rb:185:in `block in pop'
from <internal:prelude>:10:in `synchronize'
from /home/dennis/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/thread.rb:180:in `pop'
from /home/dennis/.rvm/gems/ruby-1.9.2-p180/gems/emdrb-0.4.4/lib/emdrb/emdrb.rb:894:in `method_missing'
from client.rb:52:in `block in initialize_ui'
from /home/dennis/.rvm/gems/ruby-1.9.2-p180/gems/qtbindings-4.6.3.2/lib/Qt/qtruby4.rb:2427:in `call'
from /home/dennis/.rvm/gems/ruby-1.9.2-p180/gems/qtbindings-4.6.3.2/lib/Qt/qtruby4.rb:2427:in `invoke'
from client.rb:73:in `qt_metacall'
#Pajton:
import threading
from time import sleep
class watek(threading.Thread):
def __init__(self):
while(not sleep(3)):
print 'foobar'
watek()
require 'Qt4'
require 'qtwebkit'
app = Qt::Application.new(ARGV)
web_view = Qt::WebView.new
web_view.load(Qt::Url.new('http://nightly.webkit.org'))
web_view.show()
web_view.page.linkDelegationPolicy = 2
web_view.connect(SIGNAL "linkClicked(const QUrl)") { |url|
#include <QtNetwork>
#include <QtGui>
#include "server.h"
#include <QObject>
#include <QMessageBox>
Server::Server(QMainWindow *window)
{
tcpServer = new QTcpServer();
class Sum : public XmlRpcServerMethod
{
public:
Sum(XmlRpcServer* s) : XmlRpcServerMethod("Sum", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
double sum = 0.0;
for (int i=0; i<nArgs; ++i)
module Command
class << self
%w[shutdown reboot open close].each do |method_name|
define_method method_name do
lambda do
puts method_name
Thread.new { $selected_client.client_rpc.send(method_name) } #this way does not work
Thread.new { eval("$selected_client.client_rpc.#{method_name}") } #this way does
require 'Qt4'
include Qt
Application.new ARGV do
MainWindow.new do
Label.new 'foobar', self
show
end
exec
end
require 'Qt4'
include Qt
app = Application.new ARGV
w = MainWindow.new
Label.new('foobar',w)
w.show
app.exec