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 matching tags of Type
//start processing
var api = new moviesApi();
api.getRatings({
    success: function (result) {
        for (var i = 0; i < result.length; i++) {
            //new Option(text, value)
            var option = new Option(result[i].ID, result[i].Name);
            $('#ratings').append(
                $('<option></option>').val(result[i].ID).html(result[i].Name)
            );
22 Views
no comments
 
//Create and type variable
var moviesApi = function () { }
 
moviesApi.prototype.getRatings = function (options) {
    $.ajax({
        url: applicationUrl + '/Api/movies/getratings',
        type: 'GET',
        success: options.success,
        error: function (result) {
            displayError(result);
by Warren Wiltshire   May 02, 2012 @ 5:19am
31 Views
no comments
 
C#
public static class TypeEx
{
    public static string GetFriendlyName(this Type t)
    {
        using (var provider = new CSharpCodeProvider())
        {
            var typeRef = new CodeTypeReference(t);
            return provider.GetTypeOutput(typeRef);
        }
    }
by bnaya   January 10, 2012 @ 3:21am
62 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
192 Views
1 comments
 
C++
#include <new>
#include <utility>
 
// This macro is variadic in order to directly support operator,
#define BOOST_AUTO_FUNCTION( ... ) auto __VA_ARGS__ -> BOOST_AUTO_FUNCTION_IMPL
 
#define BOOST_AUTO_VOID_FUNCTION( ... )                                        \
auto __VA_ARGS__ -> BOOST_AUTO_VOID_FUNCTION_IMPL
 
// Variadic to support expressions with commas not between parentheses
by Matt Calabrese   October 13, 2010 @ 4:22pm
292 Views
no comments
 
C#
[Mixin("String.prototype")]
public static class StringExtensions
{
    public static bool StartsWith(string value)
    {
        return ((string)Script.Literal("this")).IndexOf(value) == 0;
    }
}
by Bruno Figueiredo   October 13, 2010 @ 2:47pm
351 Views
1 comments
 
C#
// Define a list by enclosing the item type in brackets [int]
// and initialize its value.
 
Scores : [int] = [ 92, 100, 85, 62, 81, 100 ];
 
// Option A
 
// require the stream type to be specified on a property
PassingScores : int*
{
by Dan Vanderboom   June 16, 2010 @ 1:07pm
258 Views
no comments
 
//***************************************
// Description: Display images in a simple teletype style.
// Usage: $(".teletype").teletype({speed: 100});
// Put all images in wrapper <div>
// e.g : <div class="teletype"><img src="/images/1.jpg" alt="" width="10" height="10"/> ... </div>
// Ensure the images are hidden 
// e.g : .teletype img { display: none }
// Params example: ({speed:100},{type:"fast"});
// Written by: Arran Maclean , A R Media Ltd.  22/03/2010
//***************************************
by ArranM   March 22, 2010 @ 6:36am
426 Views
no comments
 
C#
/// <summary>
/// Return all properties from a type up to a specified base type in the inheritance hierarchy
/// </summary>
/// <param name="type">Type that will be examined</param>
/// <param name="baseType">Where to stop in the inheritance hierarchy. Must be a type that first parameter inherits from
/// </param>
/// <returns>A list of all found properties</returns>
public static List<PropertyInfo> GetAllProperties(Type type, Type baseType)
{
   List<PropertyInfo> properties = new List<PropertyInfo>();
499 Views
no comments
 
C#
/// <summary>
/// Return all properties from a type up to a specified base type in the inheritance hierarchy
/// </summary>
/// <param name="type">Type that will be examined</param>
/// <param name="baseType">Where to stop in the inheritance hierarchy. Must be a type that first parameter inherits from
/// </param>
/// <returns>A list of all found properties</returns>
public static List<PropertyInfo> GetAllProperties(Type type, Type baseType)
{
   List<PropertyInfo> properties = new List<PropertyInfo>();
by Robert Andersson   March 11, 2010 @ 12:25pm
336 Views
no comments
 
C#
/// <summary>
/// Turns a string into a typed value generically.
/// Explicitly assigns common types and falls back
/// on using type converters for unhandled types.         
/// 
/// Common uses: 
/// * UI -&gt; to data conversions
/// * Parsers
/// <seealso>Class ReflectionUtils</seealso>
/// </summary>
by Rick Strahl   January 08, 2010 @ 4:21pm
1373 Views
no comments
 
C#
// **********************************
// By Roy Osherove : www.osherove.com
// see example usage of this code at http://weblogs.asp.net/rosherove/archive/2009/10/23/typemoq-api.aspx 
// **********************************
 
using System;
using System.Linq;
using System.Linq.Expressions;
using TypeMock.ArrangeActAssert;
by Roy Osherove   October 23, 2009 @ 6:08am
723 Views
no comments
 
C#
//Class Under Test
public class CategoryRepository : BaseRepository<Category>
{
    //EntityContainer is an ObjectContext
    public CategoryRepository(EntityContainer context)
        : base(context){}
 
    //Method Under Test
    public Category FindById(Guid id)
    {
by Muhammad Mosa   September 02, 2009 @ 10:58am
527 Views
no comments
 
C#
namespace Repository.EntityFramework
{
    //Entity Class Under Test
    public partial class Story
    {
        public ICollection<Tag> Tags
        {
            get
            {
                if(!TagsInternal.IsLoaded)
by Muhammad Mosa   September 01, 2009 @ 2:38pm
384 Views
no comments
 
C#
//Class under test code snippet
public class CategoryRepository : BaseRepository<Category>
{
        //EntityContainer class is an ObjectContext of Entity Framework
        public CategoryRepository(EntityContainer context)
            : base(context)
        {
        }
        public override void Add(Category category)
        {
by Muhammad Mosa   August 31, 2009 @ 1:55pm
366 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