Skip to content

Instantly share code, notes, and snippets.

@manadart
manadart / 01_GreetingAspect.cs
Created March 25, 2011 08:22
Example usage of TinyIoC - the first with constructor injection, the second with property injection.
namespace TinyIoCDemo
{
// This is the interface for my aspect - the dependency for my classes.
public interface IAspectDependency
{
string GetGreeting();
}
// And here is an implementation.
public class GreetingAspect : IAspectDependency
@manadart
manadart / 01PackageHeader.sql
Created June 23, 2011 10:11
Oracle throws "ORA-21700: object does not exist or is marked for delete" when referencing a type declared inside a package, externally.
-- This is the top few lines of my package header, showing the type declarations.
create or replace package aims_migration as
type r_aims_wo_item is record(ref_identifier varchar(50), geometry sdo_geometry);
type t_aims_wo_item is table of r_aims_wo_item;
-- Rest of the package spec...
end aims_migration
@manadart
manadart / 1_IoC.cs
Created October 25, 2011 13:41
Quick and nasty example of instantiation and use of the new GT APM.
using System.Configuration;
using GeomaticTechnologies.Databases;
using GeomaticTechnologies.Security.Apm;
using GeomaticTechnologies.Security.Apm.ClauseGenerators;
using GeomaticTechnologies.Security.Apm.DataServices;
using TinyIoC;
namespace NewApmDemo
{
public static class IoC
@manadart
manadart / floating_footer.scss
Created November 16, 2011 14:31
Good ol' pre-HTML5 floating footer with SASS.
@manadart
manadart / Client.cs
Created March 19, 2012 19:20
Example usage of service call to SS FMC using a service client.
// This code requires the following assemblies to be referenced:
// ServiceStack.Common
// ServiceStack.Interfaces
// ServiceStack.ServiceInterface
// GeomaticTechnologies.Eis.Yvw.ServiceModel
using System.Collections.Generic;
using System.Net;
using GeomaticTechnologies.Eis.Yvw.ServiceModel;
using ServiceStack.Service;
@manadart
manadart / Guid.cs
Created April 16, 2012 11:36
Utility for generating GUIDs/UUIDs congruent with those generated by Oracle.
public static class GuidFactory
{
public static string Last { get; set; }
public static string Next
{
get
{
Last = System.Guid.NewGuid().ToString().Replace("-", string.Empty);
return Last;
@manadart
manadart / app.rb
Created August 25, 2012 11:33
async_sinatra cannot determine application with Sinatra 1.3.3
require 'sinatra/base'
require 'sinatra/async'
class MyApp < Sinatra::Base
register Sinatra::Async
configure do
set :raise_errors, false
set :show_exceptions, false
enable :logging
@manadart
manadart / upload.rb
Created November 5, 2012 17:35 — forked from anonymous/upload.rb
Sinatra Upload
require 'rubygems'
require 'sinatra'
include FileUtils::Verbose
get '/up' do
erb :form
end
post '/up' do
tmpfile = params[:file][:tempfile]
@manadart
manadart / size.cs
Created November 5, 2012 17:55
MonoDroid Screen Size
// Method One.
var disp = WindowManager.DefaultDisplay;
var height = disp.Height;
var width = disp.Width;
Console.WriteLine("Default Display: {0}x{1}", width, height);
// Method Two.
@manadart
manadart / payload.go
Last active August 29, 2015 14:06
Go Concurrent Slice Blog Post
// Payload type extending a slice of items.
type Payload []*itemType
// Use a pool of Goroutines to run the input action against all the items, with the input concurrency factor.
func (payload Payload) ExecuteAction(action func(*itemType), concFactor int) {
itemsChl := make(chan *itemType)
wg := new(sync.WaitGroup)
wg.Add(concFactor)
// Set up the pool with a number of Goroutines equal to our concurrency factor.