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
// Interface and class | |
export interface Printer { | |
print(text: string): string; | |
} | |
export class Logger implements Printer { | |
// Need to make it public to work in examples above. | |
// I would like to keep it private but then compiler complains | |
constructor(public logFunction = (text: string) => { return text; } ) { } |
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
The node ambient module defines a require with type NodeRequire which means that var require : any will claim that it needs type NodeRequire. | |
Doesn't seem like requirejs typings define RequireConfig anymore either? | |
var require = { | |
paths: { | |
"jquery": "../bower_components/jquery/dist/jquery" | |
} | |
}; |
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 qsKeys = Request.QueryString.AllKeys; | |
if (qsKeys.Contains("SPAppWebUrl")) | |
{ | |
AppWebUrl.Value = Request.QueryString["SPAppWebUrl"]; | |
} | |
else | |
{ | |
var rootUri = new UriBuilder(String.Concat(new Uri(Request.QueryString["SPHostUrl"]).Authority, "/sites/apps")) | |
{ |
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
// vars from init | |
// , companyParam = { symbol: "TEST1" } | |
// , quoteParams = [{ close: 123 }, { close: 12 }, { close: 123 }] | |
it('can create quotes with companies', function(done) { | |
db.Company.create(companyParam).success(function (company) { | |
quoteParams.map(function (item) { | |
item.CompanyId = company.id; | |
}); |
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
class Tester | |
def test statement, &block | |
puts "Running test with #{statement}" | |
block.call | |
puts "Continuing test" | |
end | |
end | |
tester = Tester.new | |
tester.test("string param") { puts "Running block" } |
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
Hi, | |
Today, the Pingdom team deployed a software upgrade to some of our | |
monitoring probes. Despite thorough testing, this upgrade contained a | |
malfunction that led to false down alerts being sent to a portion of our | |
customers, including you. | |
Even if the issue affected monitoring for less than 90 minutes for a | |
limited number of customers, it's of course frustrating if you were one | |
of them. We take a lot of pride in delivering a reliable service and |
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
module FormHelper | |
def errors_for model, field | |
if model.errors[field].present? | |
content_tag :span, :class => 'error_explanation' do | |
model.errors[field].join(", ") | |
end | |
end | |
end | |
def text_fields_for f, model |
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
# From http://stackoverflow.com/questions/4589731/git-blame-statistics | |
# Performs a git blame on the repo and sorts the results | |
git ls-tree -r HEAD | gsed -re 's/^.{53}//' | \ | |
while read filename; do file "$filename"; done | \ | |
grep -E ': .*text' | gsed -r -e 's/: .*//' | \ | |
while read filename; do git blame "$filename"; done | \ | |
ruby -ne 'puts $1.strip if $_ =~ /^\w{8} \((.*?)\s*\d{4}-\d{2}-\d{2}/' | \ | |
sort | uniq -c | sort -rg |
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
def triangle(*args) | |
[:equilateral, :isosceles, :scalene][args[0..2].uniq.size-1] | |
end | |
def triangle(a,b,c) | |
[:equilateral, :isosceles, :scalene].fetch([a,b,c].uniq.size - 1) | |
end |
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
http://avdi.org/devblog/2011/04/11/screencast-taping-api-interactions-with-vcr/ | |
== What is it | |
Testing web apps. Modern web apps are more often then not interconnected and talking with at least one RESTful api. These can be social networking sites, url shorteners, payment gateways etc. | |
This presents an interesting problem when it comes to high level integration testing. There are a few different approaches to testing on this level. | |
* Live testing - Talking directly to external sources | |
Slow, makes continuous integration a pain | |
Dependant on the services, can be in maintenance mode |
NewerOlder