Skip to content

Instantly share code, notes, and snippets.

@model EditUserModel
@using (Html.BeginForm())
{
<div>
@Html.HiddenFor(m => m.Id)
@Html.TextBoxFor(m => m.FirstName)
@Html.TextBoxFor(m => m.LastName)
@Html.DropDownListFor(m => m.CountryId, Model.Countries.Select(c => new SelectListItem { Value = c.Id, Text = c.Name })
SELECT * FROM information_schema.tables
select * from information_schema.columns where table_name = [table name]
public static TResult With<TInput, TResult>(this TInput o,
Func<TInput, TResult> evaluator)
where TResult : class
where TInput : class
{
if (o == null) return null;
return evaluator(o);
}
public static TResult Return<TInput, TResult>(this TInput o,
CREATE PROCEDURE [dbo].[UserAccount_Create]
(
@Name varchar(10)
, @FullName varchar(100)
, @LoginTitle varchar(100) = null
, @LoginMessage varchar(2000) = null
, @WelcomeMessage varchar(8000) = null
, @Domain varchar(100) = null
, @RegionId int = null
, @ExternalRef varchar(50) = null
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ExcelImporter.Util.XmlModel;
using OfficeOpenXml;
using OfficeOpenXml.Table;
namespace ExcelImporter.Util.ExcelReader
{
@amogram
amogram / UmbracoTags.cshtml
Last active May 9, 2018 12:25
Using Umbraco Tags in a view
@if (@Model.Content.GetPropertyValue("tags") != null)
{
var tags = Model.Content.GetPropertyValue("tags").TryConvertTo<string>();
string[] tagArray = { };
if (tags.Success)
{
tagArray = tags.Result.Split(',');
}
if (tagArray.Any())
@amogram
amogram / DateTimeHelpers.cs
Last active September 8, 2016 14:42
Gets the date for the next day. If it's today, return today.
using System;
namespace Common.DateTimeHelpers
{
public static class DateTimeHelpers
{
/// <summary>
/// Gets the date of the next specified day. If it's today, return today.
/// </summary>
/// <param name="from">The date</param>
$ErrorActionPreference = "Stop"
function ImportLogFiles([string] $httpLogPath)
{
If ([string]::IsNullOrEmpty($httpLogPath) -eq $true)
{
Throw "The log path must be specified."
}
[string] $logParser = "${env:ProgramFiles(x86)}" `
@amogram
amogram / createtable.sql
Created November 8, 2016 14:01
IIS Log Table Starting Point
USE [ServerFileLogs]
GO
/****** Object: Table [dbo].[TempLogs] Script Date: 08/11/2016 14:01:07 ******/
DROP TABLE [dbo].[TempLogs]
GO
/****** Object: Table [dbo].[TempLogs] Script Date: 08/11/2016 14:01:07 ******/
SET ANSI_NULLS ON
GO
@amogram
amogram / umbraco.gitignore
Created November 16, 2016 10:12
A .gitignore file for Umbraco projects
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates