Skip to content

Instantly share code, notes, and snippets.

View abhishekluv's full-sized avatar
🎯
Actively seeking opportunities

(Abby) Abhishek Luv abhishekluv

🎯
Actively seeking opportunities
View GitHub Profile
@abhishekluv
abhishekluv / generic-repository.cs
Last active May 24, 2016 22:09
Generic Repository Interface in CSharp
public interface IRepository<T> : IDisposable where T : class
{
IQueryable<T> All();
bool Any(Expression<Func<T, bool>> predicate);
int Count { get; }
T Create(T t);
@abhishekluv
abhishekluv / MyImageHandler.cs
Last active May 24, 2016 22:05
Creating a custom HTTP Handler
public class MyImageHandler : IHttpHandler
{
public book IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
// here you will set the MIME type for response
@abhishekluv
abhishekluv / Web.config
Created March 10, 2014 16:51
Registering Custom HTTP Handler using Web.config
<configuration>
<system.WebServer>
<handlers>
<add verb="*" path=".jpg" type="MyImageHandler" name="MyImageHandler"/>
</handlers>
</system.WebServer>
</configuration>
@abhishekluv
abhishekluv / LogModule.cs
Created March 12, 2014 14:50
Custom HTTP Module
using System;
using System.Web;
using System.Diagnostics;
public class LogModule : IHttpModule {
public LogModule(){
//constructor
}
@abhishekluv
abhishekluv / Web.Config
Created March 12, 2014 15:00
Registering Custom HTTP Module
<configuration>
<system.WebServer>
<modules>
<add name="LogModule" type="LogModule"/>
</modules>
</system.WebServer>
</configuration>
@functions {
// To support the layout classifaction below. Implementing as a razor function because we can, could otherwise be a Func<string[], string, string> in the code block following.
string CalcuClassify(string[] zoneNames, string classNamePrefix) {
var zoneCounter = 0;
var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
}
}
@{
/* Global includes for the theme
@abhishekluv
abhishekluv / Receiving Email Notifications for New Subscribers With Sendy.js
Last active November 30, 2016 04:47
Receiving Email Notifications for New Subscribers With Sendy.js
$("#submit").click(function() {
if (document.getElementById("email").value.length === 0) {
alert("please enter your email address");
return false;
} else if (document.getElementById("name").value.length === 0) {
alert("please enter your name");
return false;
} else if (document.getElementById("MobilePhone").value.length === 0) {
alert("please enter your mobile number");
return false;
@abhishekluv
abhishekluv / Sendy Subscribe Form Code.html
Created December 21, 2015 02:22
Sendy Subscribe Form Code
<form action="http://example.com/subscribe" method="POST" accept-charset="utf-8">
<input class="form-control input-lg" type="text" name="name" required id="name" placeholder="Name"/>
<br/>
<input class="form-control input-lg" type="email" name="email" required id="email" placeholder="Email" pattern="[a-zA-Z0-9._\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,4}"/>
<br/>
<input class="form-control input-lg" type="tel" name="MobilePhone" required id="MobilePhone" placeholder="Phone"/>
</p>
<p>
<input class="form-control input-lg" type="text" name="WorkshopDate" id="WorkshopDate" placeholder="Click Here To Select a Sunday. (Date Format : Date/Month/Year)" required readonly="true"/>
<br/>
@abhishekluv
abhishekluv / index.html
Created February 17, 2016 10:41
Playing with AMP aka Accelerated Mobile Pages
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>Hello, AMPs</title>
<link rel="canonical" href="http://example.ampproject.org/article-metadata.html" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{ "@context": "http://schema.org", "@type": "NewsArticle", "headline": "Open-source framework for publishing content", "datePublished": "2015-10-07T12:02:41Z", "image": [ "logo.jpg" ] }
</script>
<style>
.youtube-wrapper {
display: block;
width: 100%;
max-width: 600px;
border: solid 1px;
margin: 20px auto;
}
.youtube-player {