Skip to content

Instantly share code, notes, and snippets.

(function ($) {
$.fn.switchery = function (option) {
$(this).each(function () {
if (typeof option === "string") {
var switchery = $(this).data("jquery.switchery");
if (switchery) {
if (option.toLowerCase() == "check") {
if (!switchery.isChecked()) {
$(switchery.switcher).click()
}
public static class HtmlExtension
{
private static string[] htmlBooleanAttributes = (new[] { "selected", "checked", "disabled", "readonly", "multiple" }).SelectMany(x => new[] { x + "=\"\"", x + "=\"false\"" }).ToArray();
public static IHtmlString HackIt(this IHtmlString htmlString)
{
if (htmlString != null)
{
string str = htmlString.ToString();
foreach (var attribute in htmlBooleanAttributes)
{
@ArjunVachhani
ArjunVachhani / gist:b093855e71dc377e1d90
Last active December 18, 2015 07:20
image file thumb
class Program
{
public static void GenerateImageFileThumb(string file, string outputFile, float width, float height, ThumbOption option)
{
if (option == ThumbOption.Scale)
{
using (Bitmap image = new Bitmap(file))
{
float scale = Math.Min(width / image.Width, height / image.Height);