Skip to content

Instantly share code, notes, and snippets.

@asoftwareguy
asoftwareguy / Quicksort.java
Created July 5, 2011 12:49
Blog - QuickSort Example
package example.sort;
public final class Quicksort {
/**
* Sort the given array, calling the recursive sort method..
*
* @param array
* the array we are sorting
*/
@asoftwareguy
asoftwareguy / XmlExpandoObject.cs
Created July 5, 2011 13:11
Blog - XmlExpandoObject
using System;
using System.Dynamic;
using System.Xml.Linq;
using System.Linq;
using System.Collections.Generic;
namespace Test
{
public class XmlExpandoObject
{
@asoftwareguy
asoftwareguy / applicationContext.xml
Created July 5, 2011 13:20
Blog - Spring PropertyPlaceholderConfigurer
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd
@asoftwareguy
asoftwareguy / AuthorityGranter.java
Created July 5, 2011 13:32
Blog - Spring Security 2.x with multiple credentials
package example.multicred;
import java.util.Set;
import org.springframework.security.GrantedAuthority;
/**
* Handler interface for granting authorities.
*
*/
@asoftwareguy
asoftwareguy / AncientTemperature.java
Created March 12, 2012 15:32
A Groovy temperature conversion with Categories
package com.asoftwareguy.temperature;
/**
* This is an "old" existing Java class representing temperature.
* It assumes the unit is Fahrenheit.
*
*/
public final class AncientTemperature {
// in degrees Fahrenheit
@asoftwareguy
asoftwareguy / SessionExtensions.cs
Created September 20, 2013 01:51
SessionExtensions.cs
using System;
using System.Web;
namespace Example.Web.Utils
{
public static class SessionExtensions
{
public static void SetAttribute(this HttpSessionStateBase Session, string name, object value, params Func<bool>[] conditionPredicates)
{
if (conditionPredicates != null)