Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / Readme.txt
Created July 27, 2010 07:25 — forked from dieseltravis/Readme.txt
YUI compressor
Example usage:
...in <head>:
<link rel="stylesheet" type="text/css" href="/YuiCompressor.ashx?css=reset,style" />
...just before the </body>:
<script type="text/javascript" src="/YuiCompressor.ashx?js=main,someotherscript"></script>
Changelog:
2010-02-18: Updated to support HTTP compression
@prabirshrestha
prabirshrestha / Find Control Recursively
Created October 12, 2010 06:25
Find Controls Recursive
namespace Helpers.Net.Web
{
using System.Web.UI;
public static partial class WebHelper
{
/// <summary>
/// Finds a Control Recursively.
/// </summary>
/// <typeparam name="T">Type control.</typeparam>
@prabirshrestha
prabirshrestha / gist:629705
Created October 16, 2010 11:44
Resharper LiveTemplate for BsdLicense
<TemplatesExport family="Live Templates">
<Template uid="794587b4-3bf5-4e82-83a7-525babed327f" shortcut="bsdlicense" description="BSD License" text="/**&#xD;&#xA;=====================================================================================&#xD;&#xA;$ProjectName$ is intended to be used in both open-source and commercial environments.&#xD;&#xA;=====================================================================================&#xD;&#xA;3-clause license (&quot;New BSD License&quot;)&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;Copyright (c) $Year$, $Author$&#xD;&#xA;All rights reserved.&#xD;&#xA;&#xD;&#xA;Redistribution and use in source and binary forms, with or without&#xD;&#xA;modification, are permitted provided that the following conditions are met:&#xD;&#xA;&#xD;&#xA; * Redistributions of source code must retain the above copyright&#xD;&#xA; notice, this list of conditions and the following disclaimer.&#xD;&#xA; * Redistributions in binary form must reproduce the above copyright&#xD;&#xA; notice
@prabirshrestha
prabirshrestha / install_dependencies.rb
Created October 16, 2010 14:19
ruby gems install dependencies
require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'
required_version = Gem::Requirement.new "> 1.8.5"
unless required_version.satisfied_by? Gem.ruby_version then
abort "Expected Ruby Version #{required_version}, was #{Gem.ruby_version}"
end
@prabirshrestha
prabirshrestha / hgrc
Created October 17, 2010 07:57
hgrc file for nupack
[paths]
default = https://hg01.codeplex.com/forks/prabirshrestha/cls
[extensions]
reviewboard = D:\Prabir\Documents\PortableApps\msys\msys\1.0\share\mercurial-reviewboard
[reviewboard]
server = http://reviewboard.nupack.com/
user = prabir
@prabirshrestha
prabirshrestha / RemoveWhitespaceWithSplit
Created October 19, 2010 06:00
Remove Whitespace with split
// http://www.aspdotnetfaq.com/Faq/How-to-remove-duplicate-Whitespace-Characters-from-a-string.aspx
public static string RemoveWhitespaceWithSplit(string inputString)
{
StringBuilder sb = new StringBuilder();
string[] parts = inputString.Split(new [] { ' ', '\n', '\t', '\r', '\f', '\v' }, StringSplitOptions.RemoveEmptyEntries);
int size = parts.Length;
for (int i = 0; i < size; i++)
sb.AppendFormat("{0} ", parts[i]);
@prabirshrestha
prabirshrestha / DiffMatchPatchProgram.cs
Created November 5, 2010 05:45
DiffMatchPatch command line
/* to build:
* download DiffMatchPatch from http://code.google.com/p/google-diff-match-patch/
* then in command line run
* "%WINDIR%\Microsoft.NET\Framework\v3.5\csc.exe" /out:DiffMatchPatch.exe DiffMatchPatch.cs DiffMatchPatchProgram.cs
*
* to create patch:
* DiffMatchPatch.exe file1 file2 destination
* to apply patch
* DiffMatchPatch.exe patch file_to_patch
*/
@prabirshrestha
prabirshrestha / SubSpec.resharper.livetemplates.xml
Created November 6, 2010 06:29
SubSpec Resharper LiveTemplates
<TemplatesExport family="Live Templates">
<Template uid="b01f5164-ebc7-4796-92a7-dfebea08afb3" shortcut="sa" description="SubSpec Assert" text="&quot;$Assert$&quot;&#xD;&#xA; .Assert(&#xD;&#xA; () =&gt; { $END$ });" reformat="True" shortenQualifiedReferences="True">
<Context>
<CSharpContext context="Statement" minimumLanguageVersion="2.0" />
</Context>
<Categories>
<Category name="SubSpec" />
</Categories>
<Variables>
<Variable name="Assert" expression="" initialRange="0" />
@prabirshrestha
prabirshrestha / GetPathRelativeToExecutable
Created November 9, 2010 07:20
GetPathRelativeToExecutable
public static string GetPathRelativeToExecutable(string fileName)
{
string executable = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath;
return System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(executable), fileName));
}
@prabirshrestha
prabirshrestha / LogoutFacebook.aspx
Created November 23, 2010 06:12
Logout of Facebook website using FacebookJsSdk
<%@ Page Language="C#" %>
<%@ Import Namespace="FacebookSharp.Web.JavascriptSdk" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Logging you out of facebook...</title>
</head>
<body>
<form id="form1" runat="server">