Skip to content

Instantly share code, notes, and snippets.

@MMF
MMF / MappingExtensions.cs
Last active September 7, 2023 19:47
MappingExtensions For C#
using System.Linq.Expressions;
namespace Utilities.Extentions;
public static class ObjectExtensions
{
/// <summary>
/// dynamically set the value of an object's property using property name.
/// </summary>
/// <param name="obj"></param>
@MMF
MMF / PrayerTime.cs
Last active May 8, 2023 19:36
PrayerTime C# Class
//--------------------- Copyright Block ----------------------
/*
PrayTime.cs: Prayer Times Calculator (ver 1.2)
Copyright (C) 2007-2010 PrayTimes.org
C# Code By: Jandost Khoso
Original JS Code By: Hamid Zarrabi-Zadeh
License: GNU LGPL v3.0
@MMF
MMF / ActiveDirectoryHelper.cs
Last active October 4, 2021 18:19
Authenticate user with Active Directory
using System;
using System.Configuration;
using System.DirectoryServices;
namespace StrategicPlans.Helpers
{
public class ActiveDirectoryHelper
{
public string ActiveDirectoryServerPath { get; set; }
@MMF
MMF / EnumUtil.cs
Last active March 5, 2017 08:37
EnumUtil Class For ASP.NET MVC - Generates HTML Select, HTML Radio From Enum Code
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Web;
namespace SolutionName.Helpers
{
public static class EnumUtil
@MMF
MMF / AjaxOnlyAttribute.cs
Created March 5, 2017 08:17
AjaxOnly Attribute fot ASP.NET MVC Controller's method
using System.Reflection;
using System.Web.Mvc;
namespace SolutionName.Helpers
{
// request must be ajax
// used with controller methods
public class AjaxOnlyAttribute : ActionMethodSelectorAttribute
{
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
@MMF
MMF / WindowsTask.php
Last active May 2, 2017 10:23
create windows tasks from PHP
<?php
/*
* This class will be responsible for create/delete windows tasks
* Sample code:
*
$task = new WindowsTask('my monthly task', 'USERNAME', 'PASSWORD");
$task->schedule_type = WindowsTask::ScheduleType_MONTHLY;
$task->start_time = '12:41';
$task->command = 'notepad';
$task->day = '30';