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 nurl1 | |
{ | |
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
if(args.Length<1 || !(Regex.Match(args[0],@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b").Success)) | |
throw new ArgumentException("not a valid ip number"); | |
Console.WriteLine("Country for ip [{0}]",args[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
//Imagine you have a Cart with items you can add into | |
public class Cart | |
{ | |
public int Id {get;private set} | |
public List<CartItem> Items {get;private set} | |
public Cart(int id) { Id = id;} | |
//while writing your tests, you (want to) arrive to these checks (3 situations to test) | |
public void AddItem(CartItem item) { |
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
void Main() | |
{ | |
var a = (Meter)123 + (Kilometer)2.3 + (Centimeter)1234; | |
Console.WriteLine(a.ToString()); | |
Console.WriteLine(a.To<Kilometer>().ToString()); | |
Console.WriteLine(a.To<Centimeter>().ToString()); | |
var b = (Meter)2 * (Centimeter)30; | |
Console.WriteLine(b.ToString()); | |
Console.WriteLine(b.ToSurface<Centimeter>().ToString()); |
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
// 2) | |
public static class AppDomainAssemblyTypeScannerIgnoreHelper | |
{ | |
private static IEnumerable<Func<Assembly,bool>> _ignoreList; | |
public static IEnumerable<Func<Assembly,bool>> IgnoreList | |
{ | |
get { return _ignoreList;} | |
set {_ignoreList = value;} | |
} |
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
/* | |
* Bookmarklet for viewing source in iPad Safari | |
*/ | |
javascript:(function(){ | |
var w = window.open('about:blank'), | |
s = w.document; | |
s.write('<!DOCTYPE html><html><head><title>Source of ' + location.href + '</title><meta name="viewport" content="width=720, maximum-scale=1.0, minimum-scale=1.0, initial-scale=1.0" /></head><body></body></html>'); | |
s.close(); |
NewerOlder