Skip to content

Instantly share code, notes, and snippets.

@azcoov
azcoov / outlok_file_script.vb
Created January 23, 2011 02:34
outlook file script
Sub FileItem()
Dim Item As MailItem
Set Item = Outlook.Application.ActiveExplorer.Selection.Item(1)
Item.ShowCategoriesDialog
If Not Item.Categories = "" Then
Item.UnRead = False
Set dstFolder = GetFolder("Mailbox - ME\File")
Item.Move dstFolder
End If
End Sub
@azcoov
azcoov / complex_route_link.cs
Created January 23, 2011 02:28
Complex Route Link
@azcoov
azcoov / blog_routes.cs
Created January 23, 2011 02:26
routes for my blog
routes.MapRoute(
"BlogPost",
"Entries",
new { controller = "Blog", action = "BlogPost"}
); // outputs: mysite.com/Entries?id=0
routes.MapRoute(
"BlogPost1",
"Entries/{id}",
new { controller = "Blog", action = "BlogPost" }
@azcoov
azcoov / FindAllBlogCategories.cs
Created January 23, 2011 02:24
Linq to find all tags for tag cloud
// Repository
public IEnumerable<BlogCategory> FindAllBlogCategories()
{
return db.BlogCategories.OrderBy(c => c.BlogCategory_ID);
}
@azcoov
azcoov / blog_helper.cs
Created January 23, 2011 02:20
Weighted Tag Class
public static class BlogHelper
{
public static string GetTagClass(int id)
{
if (id % 2 == 0)
{
return "post-tag pop1";
}
else
{
@azcoov
azcoov / tag_cloud_partial_view.html
Created January 23, 2011 02:19
Tag Cloud Partial View
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="recent-tags">
<% foreach (var t in (IEnumerable<Models.BlogCategory>)ViewData["TagCloud"])
{%>
<a href="http://mysite/Blog/Listing/<%= Html.Encode(t.Category) %>" class="<%= BlogHelper.GetTagClass(t.BlogCategory_ID) %>" ><%= t.Category %></a>
<% }%>
</div>
@azcoov
azcoov / tagcloud.js
Created January 23, 2011 02:15
Javascript for Flash tag cloud
<script type="text/javascript" src="/Content/swfobject.js"></script>
<script type="text/javascript">
var divRecentTags = document.getElementById("recent-tags");
if (divRecentTags) {
var cloud = new SWFObject("/Content/tagcloud.swf", "tagcloudflash", "275", "200", "9", "#ffffff");
cloud.addParam("allowScriptAccess", "always");
cloud.addVariable("tcolor", "0x6290B8");
cloud.addVariable("tcolor2", "0x000000");
cloud.addVariable("hicolor", "0xFE5655");
cloud.addVariable("tspeed", "100");
@azcoov
azcoov / linq_tag_cloud.cs
Created January 23, 2011 02:13
Linq Tag Cloud
var categories = from c in data.GraphicCategories
join g in data.Graphics on c.GraphicCategory_ID equals g.GraphicCategory_ID
group c by c.LongDescription into categoryGroup
select new
{
Category = categoryGroup.Key,
CategoryFrequency = categoryGroup.Count()
};
Int32 maxCategoryFrequency = (from c in categories select c.CategoryFrequency).Max();
@azcoov
azcoov / sqltagcloud.sql
Created January 23, 2011 02:12
SQL Tag Cloud
declare @MaxTagFrequency int
declare @tt_Tags table(
BlogCategory_ID int,
[Count] int
)
insert into
@tt_Tags
select top(@CountLimit)
bc.BlogCategory_ID,
@azcoov
azcoov / MVC View for rendering sparklines.html
Created January 21, 2011 22:24
MVC View for rendering sparklines
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Sparkline.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Spark Line Example
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Hello Sparkline</h2>
<p>