This file contains 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
(defun git-walk (direction) | |
(interactive) | |
(shell-command (concat "git walk " direction)) | |
(revert-buffer nil t)) | |
(defun git-walk-next () | |
(interactive) | |
(git-walk "next")) | |
(defun git-walk-prev () |
This file contains 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
RATIONALE =<<_END | |
The case for a maybe: | |
We all know true and false, right? Larry Wall once said that truth should be | |
considered evident; therefore anything in Perl is either true or false, along with | |
anything else it may be. Truth is just an aspect. | |
And we use it easily, with the if/else construct: | |
if something | |
do_something |
This file contains 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
describe("My webservices AJAX module", function () { | |
var server; | |
beforeEach(function () { | |
server = sinon.useFakeServer(); | |
server.respondWith("GET", "Products.asmx", | |
[200, { "Content-Type": "application/json" }, "{ 'some': 'data' }"]); | |
}); | |
afterEach(function () { |
This file contains 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 mylib = {}; | |
mylib.format = (function () { | |
function format(object) { | |
if (Object.prototype.toString.call(objec) == "[object Array]") { | |
return format.array(object); | |
} | |
if (typeof object == "function") { | |
return format.func(object); |
This file contains 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
/* | |
Load Sinon.JS in the SpecRunner: | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script> | |
<script type="text/javascript" src="sinon-1.0.0.js"></script> | |
<script type="text/javascript" src="sinon-ie-1.0.0.js"></script> | |
http://cjohansen.no/sinon/ | |
*/ |
This file contains 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
describe("SinonMockJQAjaxWithJasmine", function() { | |
it("should mock a jQuery ajax request", sinon.test(function () { | |
this.mock(jQuery).expects("ajax").once(); | |
jQuery.ajax({ | |
url: "/something" | |
}); | |
})); | |
it("should fail when expectations are not met", sinon.test(function () { |
This file contains 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Jasmine Test Runner</title> | |
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.0.1/jasmine.css"> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript" src="sinon-1.0.0.js"></script> |
This file contains 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 com.simplehttp; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
import org.apache.http.protocol.BasicHttpContext; | |
import org.apache.http.protocol.HttpContext; | |
import org.apache.http.util.EntityUtils; |
This file contains 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
production: &development | |
settings: here | |
development: | |
<<: *production | |
test: | |
test: settings here |
This file contains 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
TestCase("AjaxTest", sinon.testCase({ | |
testJSONResponse: function () { | |
this.server.respondWith( | |
"POST", /post.*/, | |
[200, { "Content-Type": "application/json"}, | |
'{ "Exception":"", "Success":"true", "ValidationResult":"" }']); | |
$.post("/post", "data=here", function (data) { | |
jstestdriver.console.log(typeof data, data); | |
}, "json"); |