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
public class Finder | |
{ | |
RestClient client = new RestClient("http://www.imdbapi.com/"); | |
public delegate void FindingMovie(string content); | |
public event FindingMovie OnMovieFound; | |
public void FindMovie(string title) | |
{ | |
var request = new RestRequest(string.Format("?i=&t={0}&plot=full", title),Method.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
void OnMovieFound(string content) | |
{ | |
var movie = JsonConvert.DeserializeObject<Movie>(content); | |
if (movie != null && movie.Response == "True") | |
{ | |
this.movieTitleTextBlock.Text = movie.Title; | |
this.plotTextBlock.Text = movie.Plot; | |
this.ratingTextBlock.Text = movie.Rating; | |
this.releasedDattetextBlock.Text = movie.Released; |
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
require 'rubygems' | |
require "bundler/setup" | |
require 'fileutils' | |
require 'albacore' | |
require 'git' | |
$dir=Dir.pwd.gsub("/","\\") | |
$testdb="myTestDbConnectionString" | |
$proddb="MyProdDbConnectionString" |
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
First, I had to add new configuration to my csproj file | |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Mac|AnyCPU'"> | |
<DebugSymbols>true</DebugSymbols> | |
<OutputPath>bin\</OutputPath> | |
<DefineConstants>DEBUG;TRACE</DefineConstants> | |
<DebugType>full</DebugType> | |
<PlatformTarget>AnyCPU</PlatformTarget> | |
<ErrorReport>prompt</ErrorReport> | |
<WarningLevel>4</WarningLevel> |
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
In my mapping class, the method signature would be similar to this: | |
public abstract class FluentMap<TEntity> { | |
protected MyMapStuff Map(Expression<Func<TEntity, object>> propertyExpression){ | |
return this; | |
} | |
} | |
My Expression takes func where TEntity is a class such as ‘MyEntity’, and the return type is object, thus covering all various returns value seeing as every class inherit from System.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
require "test/unit" | |
require "mocha" | |
require_relative '../lib' | |
require "git" | |
class GitWrapTest < Test::Unit::TestCase | |
def test_fails_if_untrackedFiles_present_before_pull | |
git = mock() | |
fakeStatus= mock() | |
fakeStatusCount = mock() |
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
public static class EnumHelper | |
{ | |
public static List<SelectListItem> GetEnumItems<T>(this T enumType) | |
{ | |
var values = (T[]) Enum.GetValues(typeof (T)); | |
return values.Select(e => new SelectListItem {Selected = enumType.Equals(e), Text = e.ToString(), Value = e.ToString()}).ToList(); | |
} | |
public static string GetEnumStrings<T>() |
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
@using Charcoal.Core.Entities | |
@using Charcoal.Models | |
@model Charcoal.Models.StoryViewModel | |
<div class="modal-form" id="createStoryModal"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> | |
×</button> | |
<h3 id="myModalLabel"> | |
Create Story</h3> | |
</div> |
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
//Getting the authentication token | |
var token = AuthenticationService.Authenticate(Constants.Username, Constants.Password); | |
//With the authentication token, retrieving those stories is trivial | |
var service = new StoryService(token); | |
var stories= service.GetCurrentStories(projectId); | |
//This will return a list of Story objects with their associated tasks. If you would prefer getting the Iterations, which contains a list of stories *without their associated tasks*, that is easy as well. |
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
protected string RenderPartialViewToString(string viewName, object model) | |
{ | |
if (string.IsNullOrEmpty(viewName)) | |
viewName = ControllerContext.RouteData.GetRequiredString("action"); | |
ViewData.Model = model; | |
using (var sw = new StringWriter()) | |
{ | |
var viewResult = ViewEngines.Engines.FindPartialView(ControllerContext, viewName); |
OlderNewer