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
[TestFixture] | |
public class MyTests | |
{ | |
[SetUp] | |
public void BeforeTest() | |
{ | |
Console.WriteLine("BeforeTest"); | |
} | |
[TearDown] |
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
namespace API.Controllers | |
{ | |
public class GithubController : ApiController | |
{ | |
private const string _address = "https://api.github.com/users/tdshipley"; | |
private const string _userAgent = "TestApp"; | |
// GET api/<controller> | |
public async Task<string> Get() | |
{ |
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
private static bool IsJpegMatch(byte[] block) | |
{ | |
// Implementation of IsJpegMatch method omitted | |
} |
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
# Taken from http://stackoverflow.com/questions/3668345/calculate-percentage-in-ruby | |
class Numeric | |
def percent_of(n) | |
self.to_f / n.to_f * 100.0 | |
end | |
end | |
1.percent_of 10 # => 10.0 (%) |
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
10.percentage_of 100 # => 10 |
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 main | |
import ( | |
"gopkg.in/yaml.v2" | |
) | |
var data = ` | |
- name: 'Thomas' | |
- age: 25 | |
` |
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
type Person struct { | |
Name string `yaml:"name"` | |
Age int `yaml:"age"` | |
} |
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 main | |
import ( | |
"gopkg.in/yaml.v2" | |
) |
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
type Person struct { | |
Name string `json:"name"` | |
Age int `json:"age"` | |
} |
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
until file.eof? |