Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul dagda1

View GitHub Profile
View DropDownListExtensions.cs
public static class DropDownListForExtensions
{
public static IEnumerable<SelectListItem> EnumToSelectList<TEnum>(this TEnum enumObj, string defaultItem = null) where TEnum : struct
{
if (!typeof(TEnum).IsEnum) throw new ArgumentException("An Enumeration type is required.", "enumObj");
var list = new List<SelectListItem>(from TEnum e in Enum.GetValues(typeof(TEnum))
select new SelectListItem{Value = e.ToString(), Text = System.Text.RegularExpressions.Regex.Replace(
e.ToString(),
"([A-Z])",
View gemfile.rb
source 'http://rubygems.org'
#source 'http://gems.engineyard.com'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'compass'
gem 'haml'
View database.yml
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: <%= defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3' %>
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
View autocomplete.js
$(function () {
var ele_id = 'appResource';
var auto_complete = $( '#' + ele_id);
var auto_complete_hidden = $('<input id="' + ele_id + '_auto_complete_hidden' + '" type="hidden"/>');
auto_complete_hidden.insertAfter(auto_complete);
auto_complete.autocomplete({
source: app_resource_url,
minLength: 1,
View openwrap
name: Castle.Facilities.NHibernateIntegration
description: The NHibernate Facility enables the usage of NHibernate O/R framework for your components.
build: msbuild;profile=net40;project=src\Castle.Facilities.NHibernateIntegration\Castle.Facilities.NHibernateIntegration-vs2010.csproj
depends: openwrap anchored content
depends: castle.windsor
depends: log4net
depends: castle.services.transaction
depends: nhibernate
depends: Castle.Facilities.AutomaticTransactionManagement
View create-virtual-dir.ps1
function Create-VirtualDir($Parent, $FriendlyName, $VirPath)
{
$newdir = $Parent.Create("IISWebVirtualDir", $FriendlyName)
[Void]$newdir.Put("Path", $VirPath)
[Void]$newdir.Put("AccessRead", $true)
[Void]$newdir.Put("AccessWrite",$true)
[Void]$newdir.Put("AccessScript", $true)
[Void]$newdir.AppCreate2(1)
[Void]$newdir.Put("AppFriendlyName", $FriendlyName)
[Void]$newdir.SetInfo()
@dagda1
dagda1 / ajax.js
Created Feb 8, 2011
jquery 1.5 ajax
View ajax.js
function getJSONObject(url, params, ajaxCallBack, ajaxErrorHandler, excludeProgress){
var e = (ajaxErrorHandler) ? ajaxErrorHandler : validationErrorCallBack;
var s = (ajaxCallBack) ? ajaxCallBack : jsonCallBack;
if (!excludeProgress)
$('#working').show();
$.ajax({
type: "POST",
url: url,
cache: false,
data: params,
View gemfile.rb
source 'http://rubygems.org'
source 'http://gems.engineyard.com'
gem 'rails'
gem 'compass'
gem 'haml'
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
gem 'nokogiri'
View gist:838452
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: <%= defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3' %>
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
View assembly_info.rb
class AsmInfoBuilder
attr_reader :buildnumber
def initialize(baseVersion, properties)
@properties = properties;
@buildnumber = baseVersion + (ENV["CCNetLabel"].nil? ? '0' : ENV["CCNetLabel"].to_s)
@properties['Version'] = @properties['InformationalVersion'] = buildnumber;
end
You can’t perform that action at this time.