Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / main.css
Created September 9, 2012 18:50
web essentails config
// @import url("webessentials.css");
body {
}
@prabirshrestha
prabirshrestha / A.cs
Created September 10, 2012 03:30
sample app demon using owin extension methods and fluent api
var app = new List<Func<AppFunc, AppFunc>>();
app
.Use(Favicon.Middleware())
.Use(IeEdgeChromeFrameHeader.Middleware())
.Use(RemovePoweredBy.Middleware())
.Use(CrossDomainRules.Middleware())
.Use(QueryParser.Middleware())
.Use(JsonBodyParser.Middleware())
.Use(UrlEncoded.Middleware())
namespace Api
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace Nancy.Hosting.Owin
{
using System;
using Nancy.Bootstrapper;
class NancyOwinEngineWrapper : INancyEngine
{
private readonly INancyEngine engine;
private readonly Action<NancyContext> contextCallback;
@prabirshrestha
prabirshrestha / DocumentsIISExpressconfigapplicationhost.config
Created September 18, 2012 13:30 — forked from duncansmart/add urlacl.cmd
Allows IISExpress site to be externally accessed (e.g. by VM or iOS device)
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\PathToWebSite" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":1151:localhost" />
<binding protocol="http" bindingInformation="*:1151:pswin8mac.local" />
</bindings>
</site>
@prabirshrestha
prabirshrestha / gist:3783736
Created September 25, 2012 18:55
dismiss ios keyboard on tap
// in view did load
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
tapGestureRecognizer.cancelsTouchesInView = NO;
[self.tableView addGestureRecognizer:tapGestureRecognizer];
- (void)dismissKeyboard {
[self.view endEditing:YES];
}
public class SqlService {
public string ConnectionStirng { get; private set; }
public SqlService()
:this("defaultConnectionString")
{
}
public SqlService(stirng connectionString) {
@prabirshrestha
prabirshrestha / gist:3800842
Created September 28, 2012 16:38
raven db dynamic
var store = new DocumentStore() { ... };
store.Initialize();
using(var session = store.OpenSession().AsDynamic()) {
session.posts.insert(name: "....");
session.posts.insert(name: "....", content: "..." );
session.posts.insert(name: "....");
session.save();
@prabirshrestha
prabirshrestha / gist:3802798
Created September 29, 2012 01:04
Facebook C# SDK generics
public class GenericFacebookClient : FacebookClient {
public T Get<T>(string path) {
return (T)base.Api(HttpMethod.Get, path, null, typeof(T));
}
public T Get<T>(string path, object parameters) {
return (T)base.Api(HttpMethod.Get, path, parameters, typeof(T));
}
public class User
{
public string id { get; set; }
public string name { get; set; }
public Location location { get; set; }
}
public class Location
{
public string id { get; set; }