Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / StorageClientJobs.cs
Created July 16, 2012 21:29
azure job scheduling with queues
var job = new Job {
Cron = "* * * * *",
Name = "job1",
CancellationToken = CancellationToken.None,
AutoRun = true, // run once when scheduler starts then use the cron to schedule
Execute = j => Console.Run("running job");
};
var scheduler = new Scheduler();
scheduler.Add(job);
@prabirshrestha
prabirshrestha / .gitignore
Created July 27, 2012 16:06
xcode pods gitignore
# Exclude the build directory
build/*
# Exclude temp nibs and swap files
*~.nib
*.swp
# Exclude OS X folder attributes
.DS_Store
@prabirshrestha
prabirshrestha / Global.asax.cs
Created August 1, 2012 13:50
Owin Extensions without Owin.dll
using AppFunc = Func< // Call
IDictionary<string, object>, // Environment
IDictionary<string, string[]>, // Headers
Stream, // Body
Task<Tuple< //Result
IDictionary<string, object>, // Properties
int, // Status
IDictionary<string, string[]>, // Headers
Func< // CopyTo
Stream, // Body
@prabirshrestha
prabirshrestha / TextFieldChanges.m
Created August 2, 2012 13:53
Reactive Cocoa examples
@synthesize firstName = _firstName;
@synthesize txtFirstName = _txtFirstName;
[RACAbleSelf(self.firstName) subscribeNext:^(id x) { [self firstNameChanged:x]; }];
[self rac_bind:RAC_KEYPATH_SELF(self.firstName) to:self.txtFirstName.rac_textSubscribable];
- (void) firstNameChanged:(id)firstName {
NSLog(@"changed: %@", firstName);
}
@prabirshrestha
prabirshrestha / gist:3309091
Created August 9, 2012 23:44
cassette hogan pipeline
using System.Collections.Generic;
using Cassette;
using Cassette.HtmlTemplates;
using Cassette.Scripts;
using Cassette.Stylesheets;
/// <summary>
/// Configures the Cassette asset modules for the web application.
/// </summary>
public class CassetteConfiguration : IConfiguration<BundleCollection>
@prabirshrestha
prabirshrestha / module.cs
Created August 10, 2012 14:57
nancy formatting
class MyClass : NancyModule
{
public MyClass()
{
Get[Route.Root()
.AnyStringAtLeastOnce("a").And()
.AnyIntAtLeastOnce("b").And()
.AnyIntAtLeastOnce("c").And()
.AnyIntAtLeastOnce("d")] =
x =>
@prabirshrestha
prabirshrestha / socket-io-net-sample.cs
Created August 18, 2012 02:54
socket-io-net-sample
var io = new SocketIo();
io.Sockets.On("connection", socket => {
io.Sockets.Emit("this", new { will = "be received by everyone "});
socket.On("private message", (from, msg) => {
Debug.WriteLine("I received a private message by " + from + " saying " + msg);
});
../../Source/.nuget/NuGet.exe push Facebook.6.0.21-beta.nupkg -Source http://nuget.gw.symbolsource.org/Pub
lic/NuGet -ApiKey xxxxxxxxx
// goal to use this in both nancy and mvc
@Html.Universal().PagedList();
// UnivesalHtmlHelper.dll
public inteface IUniversalHtmlStringFactory {
IUniversalHtmlString Create(string str);
}
@prabirshrestha
prabirshrestha / wildcard.csproj
Created August 24, 2012 19:37
wildcard *.cs file include in .csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F1F3A37D-3372-446D-966E-DB01F710AA55}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>