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
# cs.snippets | |
# =========== | |
# | |
# Standard C-Sharp snippets for snipmate. | |
# | |
# Largely ported over from Visual Studio 2010 snippets plus | |
# a few snippets from Resharper plus a few widely known snippets. | |
# | |
# Most snippets on elements (i.e. classes, properties) | |
# follow suffix conventions. The order of suffixes to a snippet |
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('sugar'); | |
var _und = require('underscore'); | |
function getDeliveryDate() { | |
// really only need holidays that are on Friday | |
var holidays = ['11/29/2013','12/25/2013', '11/28/2014']; | |
var startDate = '10/4/2013'; | |
var deliveryDates = _und.range(100).map(function (i) { | |
var deliveryDate = Date.create(startDate).advance({weeks: 2 * i}); |
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
function Ninja() { | |
this.skulk = function () { return this; }; | |
} | |
var whatever = Ninja(); | |
console.log(whatever); | |
"But the effect would be for the skulk property to be created on window, and for window to be returned and stored in whatever" |
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
function One() { | |
this.a = function () { | |
return this.b(); | |
} | |
} | |
function b() { | |
return 1; | |
} |
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
UUID uuid = UUID.randomUUID(); |
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.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace DotNetOpenAuth.WebAPI { | |
public class CorsHandler : DelegatingHandler { | |
const string Origin = "Origin"; | |
const string AccessControlRequestMethod = "Access-Control-Request-Method"; |
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 CoreRegistry : Registry | |
{ | |
public CoreRegistry() | |
{ | |
Scan(cfg => | |
{ | |
cfg.TheCallingAssembly(); | |
cfg.WithDefaultConventions(); | |
cfg.IncludeNamespaceContainingType<Foo>(); | |
cfg.ConnectImplementationsToTypesClosing(typeof(IRenderer<>)); |
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 interface ISomeTextService { string DoSomething(); } | |
public class SomeTextService : ISomeTextService { public string DoSomething() { return string.Empty; } } | |
public interface ISomeHtmlService { string DoSomethingElse(); } | |
public class SomeHtmlService : ISomeHtmlService { public string DoSomethingElse() { return string.Empty; } } | |
public enum RenderType {Text, Html} | |
public interface IRenderer<T> { string Render(T obj); } | |
public class FooTextRenderer : IRenderer<Foo> | |
{ |
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 interface ISomeTextService { string DoSomething(); } | |
public class SomeTextService : ISomeTextService { public string DoSomething() { return string.Empty; } } | |
public interface ISomeHtmlService { string DoSomethingElse(); } | |
public class SomeHtmlService : ISomeHtmlService { public string DoSomethingElse() { return string.Empty; } } | |
public enum RenderType {Text, Html} | |
public class Foo | |
{ | |
private readonly ISomeTextService _someTextService; | |
private readonly ISomeHtmlService _someHtmlService; |
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 interface ISomeService { string DoSomething(); } | |
public class SomeService : ISomeService { public string DoSomething() { return string.Empty; } } | |
public class Foo | |
{ | |
private readonly ISomeService _someService; | |
public Foo(ISomeService someService) { _someService = someService; } | |
public string Render() | |
{ | |
return "this is a foo" + _someService.DoSomething(); |
NewerOlder