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
casper.options.verbose = true; | |
casper.options.logLevel = 'error'; | |
casper.options.waitTimeout = 5000; | |
casper.on('error', function(err) { | |
this.echo('----> ERROR <----'); | |
}); | |
casper.test.begin('Testing errors', function(test) { | |
var url = 'http://www.ynonperek.com/static/test.html'; |
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 Product = function(name, price) { | |
this.price = price; | |
this.name = name; | |
this.apply_discount = function(pct) { | |
this.name *= (1-pct); | |
}; | |
}; | |
var p1 = new Product('foo', 20); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
.page { display: none } | |
.active.page { display: block } | |
</style> | |
</head> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<svg id="container"></svg> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.0.1/d3.v3.min.js"></script> |
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
package Contacts; | |
use strict; | |
use warnings; | |
use v5.16; | |
sub init { | |
my $book_ref = {}; | |
return $book_ref; | |
} | |
sub add_contact { |
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
void PuzzleWidget::mouseMoveEvent(QMouseEvent *event) | |
{ | |
// ... | |
QByteArray src; | |
QDataStream io(&src, QIODevice::WriteOnly); | |
io << data; | |
mime->setData("myapp/data", src); | |
// ... | |
} |
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
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "products"); | |
bool ok = db.open(); |
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
#include "typer.h" | |
#include <QDebug> | |
Typer::Typer(QObject *parent) : | |
QObject(parent) | |
{ | |
m_text = "The quick brown fox jumps over the lazy dog"; | |
m_idx = 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
(function(global, $) { | |
function PersonalData() { | |
var numRetries = 3; | |
var sendData = function() { | |
$.ajax({ | |
url: '/api/data', | |
type: 'POST', | |
error: function(err) { |
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 testRetryCounter = 0; | |
var assert = chai.assert; | |
$.ajax = function(opts) { | |
testRetryCounter++; | |
setTimeout(opts.error, 0); | |
}; | |
var real_setTimeout = setTimeout; |