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 Extensions | |
{ | |
public static dynamic ToDynamic(this object value) | |
{ | |
if (value.IsListOrArray ()) { | |
var list = new List<ExpandoObject> (); | |
IEnumerable enumerable = value as IEnumerable; | |
foreach (object o in enumerable) { | |
list.Add (o.ToDynamic ()); |
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
/** | |
* HTTP Status Codes | |
* Copyright (c) 2012, marlun78 | |
* MIT License, https://gist.github.com/marlun78/bd0800cf5e8053ba9f83 | |
* | |
* Taken from: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
* Visual Studio find regex: ^(\d{3}) ([^\r\n]+)\r\n | |
* Visual Studio replace regex: '$1': '$2', // | |
* Notes wrapped in parens moved manually | |
*/ |
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 Recipe struct{} | |
func NewRecipe(*router router) *router { | |
router.HandleFunc("/recipe/{id}", GetById) | |
} | |
func GetById(writer w, *request r) *handler { | |
//do something | |
} |
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 ConsoleApplication1 | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Net; | |
using System.Security.Principal; | |
using Microsoft.Owin.Hosting; | |
using Nancy; | |
using Owin; |
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
Assuming your web app supports deep linking, like an AngularJS one would. | |
Assume basic crud of Foo. So list, create, edit and delete. | |
If a user bookmarks in your app an edit page eg/http://mydomain.com/foo/123, thanks to deep linking you now skip over the list part of navigation. | |
So the user's browser hits: | |
http://example.org/#/foos/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
namespace TestinNancyWithOwinTesting | |
{ | |
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Nancy; | |
using Nancy.Bootstrapper; | |
using Nancy.Testing; | |
using Owin; | |
using Microsoft.Owin.Testing; |
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
var fs = require('fs'), | |
path = require('path'), | |
Promise = require('rsvp').Promise, | |
request = require('request'), | |
files = [ | |
'https://www.google.com/images/srpr/logo11w.png', | |
'http://rack.1.mshcdn.com/media/ZgkyMDEzLzA5LzE2L2JjL0Jpbmdsb2dvb3JhLmFkYjJkLnBuZwpwCXRodW1iCTEyMDB4OTYwMD4/996d9598/35b/Bing-logo-orange-RGB.png', | |
'http://assets.fontsinuse.com/static/use-media-items/15/14246/full-2048x768/52c4c6bc/Yahoo_Logo.png' |
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
Create Function dbo.fn_ConvertCSVtoTable ( @input nvarchar(max), @token nchar(1)) | |
Returns @Result Table | |
(ColumnValue nvarchar(max)) | |
As | |
Begin | |
Declare @x XML | |
Select @x = CAST('<CSV>'+ REPLACE(@input, @token,'</CSV><CSV>')+ '</CSV>' AS XML) |
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
Hello there Twitter person, | |
It seems you have a programming problem and you'd like some help. There's a number | |
of (mostly) friendly people around here who can help - but first you will need to | |
provide us with some code that repoduces your problem and upload it to a github | |
repository (www.github.com). That way, we can download it, test it and see what's | |
wrong. | |
Thank you! |
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
static void Main(string[] args) | |
{ | |
Console.Write("Hello World!!"); | |
Method1("Hi", 123); | |
} | |
public static void Method1(string myString, int myInt) | |
{ | |
Method2(myString); //myInt does not appear by R# as not used | |
} |
NewerOlder