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
internal static class Program | |
{ | |
private static void Main() | |
{ | |
// runs the app as a console application if the command argument "-console" is used | |
if (WindowsServiceHelper.RunAsConsoleIfRequested<Service1>()) | |
return; | |
// uses "-install" and "-uninstall" to manage the service. | |
if (WindowsServiceHelper.ManageServiceIfRequested(Environment.GetCommandLineArgs())) |
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> | |
<html ng-app="Demo"> | |
<head> | |
<meta charset="utf-8" /> | |
<title> | |
Defining Instantiatable Classes In AngularJS | |
</title> | |
</head> | |
<body> |
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
.directive('ngInitial', ['$parse', function ($parse) { | |
return { | |
require: 'ngModel', | |
restrict: 'A', | |
link: function link(scope, element, attr, model) { | |
var val = attr.ngInitial || attr.value || element.text(); | |
$parse(attr.ngModel).assign(scope, val); | |
} | |
}; | |
}]); |
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 void GoogleGeoCode(string address, out double lat, out double lon) | |
{ | |
string url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" + address; | |
var req = (HttpWebRequest)WebRequest.Create(url); | |
var reader = new StreamReader(req.GetResponse().GetResponseStream()); | |
var body = reader.ReadToEnd(); | |
lat = double.Parse(Regex.Match(body, @"""lat\"" : ([\d\.]+)").Groups[1].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
public abstract class HttpSession : IHttpSession | |
{ | |
protected IKeyValueStore storage; | |
public virtual int UserId | |
{ | |
get { return Get<int>("user_id"); } | |
set { storage["user_id"] = 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public interface Maybe<T> { } | |
public class Nothing<T> : Maybe<T> { } | |
public class Just<T> : Maybe<T> { | |
public T Value { get; private set; } |
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 HtmlExtensions | |
{ | |
public static IHtmlString DropDownListFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, Dictionary<string, IEnumerable<SelectListItem>> selectList) | |
{ | |
/* | |
* <select name="tmodel"> | |
* <optgroup title="Items"> | |
* <option value="item">Item</option> | |
* </select> | |
*/ |
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
angular.module('services', []) | |
.factory('State', function ($rootScope) { | |
'use strict'; | |
var state; | |
var broadcast = function (state) { | |
$rootScope.$broadcast('State.Update', state); | |
}; | |
var update = function (newState) { |
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 PackageBinaryInspector : MarshalByRefObject | |
{ | |
/// <summary> | |
/// Entry point to call from your code | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="dllPath"></param> | |
/// <param name="errorReport"></param> | |
/// <returns></returns> | |
/// <remarks> |
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
<?xml version="1.0"?> | |
<configuration> | |
<configSections> | |
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | |
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | |
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | |
</sectionGroup> | |
</configSections> |