CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Rick Strahl
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Dynamic;
using System.Reflection;
 
namespace Westwind.Utilities
{
    /// <summary>
    /// Class that provides extensible properties and methods. This
by Rick Strahl   Tuesday @ 5:48pm
Tags: C#, Expando, MixIn
210 Views
1 comments
 
<!DOCTYPE html>
<html>
<head>
<style>
.boxshadow
{
     box-shadow: 4px 4px 5px #535353;
}
.roundbox
{
by Rick Strahl   January 03, 2012 @ 4:58pm
Tags: HTML, IE9, Bug
231 Views
no comments
 
C#
namespace Westwind.Utilities.Data
{
    /// <summary>
    /// This class provides an easy way to turn a DataRow 
    /// into a Dynamic object that supports direct property
    /// access to the DataRow fields.
    /// 
    /// The class also automatically fixes up DbNull values
    /// (null into .NET and DbNUll to DataRow)
    /// </summary>
by Rick Strahl   December 27, 2011 @ 3:56pm
188 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
 
namespace Westwind.Web.Services
{
    /// <summary>
    /// Implements the Gravatar API for retrieving a Gravatar image to display
by Rick Strahl   December 15, 2011 @ 4:08pm
Tags: Gravatar, C#, .NET
216 Views
2 comments
 
(function ($) {
 
$.fn.timeKeys = function (options) {
    /// <summary>
    /// Attaches a set of hotkeys to time fields
    /// + Add minute - subtract minute
    /// H Subtract Hour R Add houR
    /// ? Show keys
    /// </summary>
    /// <param name="options" type="object">
by Rick Strahl   November 28, 2011 @ 5:21am
Tags: Time, jQuery, Input
271 Views
no comments
 
C#
public class Expando : DynamicObject
{
    dynamic Instance;
    Dictionary<string, dynamic> ExtraProperties = new Dictionary<string, dynamic>();
 
    public Expando(object instance)
    {
        Instance = instance;
    }
by Rick Strahl   November 16, 2011 @ 1:35pm
231 Views
no comments
 
C#
Type ElementType = GetArrayType(ArrayType);
if (IsIDictionary)
{
    if (ArrayType.IsGenericType)
    {
        var keyType = ArrayType.GetGenericArguments()[0];
        var valueType = ArrayType.GetGenericArguments()[1];
        ElementType = typeof(keyvalue<,>).MakeGenericType(keyType, valueType);
    }                
}
by Rick Strahl   November 11, 2011 @ 12:20am
Tags:
172 Views
no comments
 
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title></title>
    <style>
    .bigbutton
    {
        background: #1e5799; /* Old browsers */        
        color: White;
by Rick Strahl   November 09, 2011 @ 6:35pm
Tags: HTML, CSS, Button
65 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Threading;
 
namespace Westwind.Utilities
{
    /// <summary>
by Rick Strahl   October 09, 2011 @ 8:57pm
229 Views
no comments
 
C#
public class ObjectFactory<T>
        where T: class, new()
{
 
...
 
/// <summary>
/// Returns a unique ID for a given type and parameter signature
/// </summary>
/// <typeparam name="T"></typeparam>
by Rick Strahl   October 09, 2011 @ 8:01pm
161 Views
1 comments
 
XML
<!-- webconnection.manifest -->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
          manifestVersion="1.0">
 
  <assemblyIdentity name="web"
                    version="8.0.0.0"
                    type="win32"
                    processorArchitecture="x86" />
  
by Rick Strahl   October 04, 2011 @ 4:03am
39 Views
no comments
 
C#
 [TestMethod]
 public void TestRenamedbContextMenu()
 {
     dbContext context = new dbContext();
 
     // Load the first menu
     Menu menu = context.Menus.FirstOrDefault();
 
     // force a change
     menu.ModifiedOn = DateTime.Now;
by Rick Strahl   September 27, 2011 @ 4:43am
243 Views
no comments
 
C#
/// <summary>
/// Creates a list of a given type from all the rows in a DataReader.
/// 
/// Note this method uses Reflection so this isn't a high performance
/// operation, but it can be useful for generic data reader to entity
/// conversions on the fly and with anonymous types.
/// </summary>
/// <typeparam name="TType"></typeparam>
/// <param name="reader">An open DataReader that's in position to read</param>
/// <param name="fieldsToSkip">Optional - comma delimited list of fields that you don't want to update</param>
by Rick Strahl   September 23, 2011 @ 3:26pm
494 Views
no comments
 
FUNCTION ShowEmail( lcRecipient,lcSubject,lcBody )
RETURN GoUrl("mailto:" + lcRecipient + ;
             "&Subject=" + STRTRAN(UrlEncode(lcSubject),"+"," ") +;
             "&Body=" + STRTRAN(UrlEncode(lcBody),"+"," "))
 
****************************************************
FUNCTION GoUrl
******************
***    Author: Rick Strahl
***            (c) West Wind Technologies, 1996
by Rick Strahl   September 23, 2011 @ 12:38am
Tags: Email, Outlook
57 Views
no comments
 
C#
/// <summary>
/// Internally used Page instance so we can get access to
/// a Page instance when no Page might be available. To Access ClientScript etc.
/// </summary>
private static Page CachedPage
{
    get
    {
        if (_CachedPage == null)
            _CachedPage = new Page();
by Rick Strahl   September 19, 2011 @ 3:27pm
Tags: jQuery
81 Views
1 comments
 
C#
var subjectString = @"
This works fine:
<a href=""_1a904m3mg.htm"" >Help Builder Features</a>  
 
This will select the first (non-matching) href and selects through the second - need to avoid this
<a href=""_2a904m3mg.htm"" >Help Builder Features</a> asdsad <a href=""_1a904m3mg.htm"" >Help Builder Features</a> 
 
Need to also match something like this:
<a href=""path/_1a904m3mg.htms"" >Help Builder Features</a>
by Rick Strahl   May 30, 2011 @ 6:56pm
Tags: RegEx, C#
424 Views
1 comments
 
if (!JSON) {
    // Autoload JSON2.js if possible
    // Note: if using a script loader you may have to explicitly load json2.js
    //       assumes loading from same folder as this script
    var scripts = $("script");
    var src = null;
    scripts.each(function (i) {
        src = $(this).attr("src");        
        if (src && src.toLowerCase().indexOf("serviceproxy.") > -1) {
            src = src.toLowerCase();
by Rick Strahl   April 05, 2011 @ 9:57pm
348 Views
no comments
 
$.ajaxSetup({ 
            converters: { "text json": function (jsonString) {
                var res = JSON.parseWithDate(jsonString);
 
                if (res && res.hasOwnProperty("d"))
                    res = res.d;
                return res;
            } }
});
by Rick Strahl   April 05, 2011 @ 8:05pm
224 Views
no comments
 
XML
<configuration>
  <system.web>
    <httpModules>
      <add name="ScriptCompressionModule" type="Westwind.Web.ScriptCompressionModule,Westwind.Web" />
    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <add name="ScriptCompressionModule" type="Westwind.Web.ScriptCompressionModule,Westwind.Web" />
by Rick Strahl   April 05, 2011 @ 2:19am
Tags:
296 Views
no comments
 
<div class="dialog" style="width: 900px;">
    <div class="dialog-header">Album Listings</div>
 
        <div class="toolbarcontainer" style="text-align: right;">
            Artist: <asp:TextBox runat="server" id="txtArtistFilter" style="width: 100px;" />
            Album: <asp:TextBox runat="server" ID="txtAlbumFilter" style="width: 100px;"/>
            <asp:Button runat="server" ID="btnFilterList" Text="Go" />
        </div>
 
        <div style="overflow-y: scroll;height: 300px; width: 400px; background: cornsilk; float:left">              
by Rick Strahl   March 30, 2011 @ 3:12pm
Tags:
167 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate