Skip to content

Instantly share code, notes, and snippets.

View vorleakchy's full-sized avatar

Vorleak Chy vorleakchy

  • Boatsetter
  • United States
View GitHub Profile
@vorleakchy
vorleakchy / Rakefile
Created August 26, 2011 17:08
WARNING: Global Access to Rake DSL Methods Is Deprecated in Rails
module ::YourApplicationName
class Application
include Rake::DSL
end
end
module ::RakeFileUtils
extend Rake::FileUtilsExt
end
@vorleakchy
vorleakchy / environment_rails_2.3.rb
Created August 26, 2011 16:40
Show SQL Statement in Rails Console
if "irb" == $0
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveResource::Base.logger = Logger.new(STDOUT)
end
@vorleakchy
vorleakchy / DatabaseInfo.cs
Created August 24, 2011 17:21
NAnt task with Red-Gate SQL Compare
using NAnt.Core;
using NAnt.Core.Attributes;
namespace SyncNAntTask
{
[ElementName("database")]
public class DatabaseInfo : Element
{
[TaskAttribute("folder", Required = true)]
public string Folder { get; set; }
@vorleakchy
vorleakchy / factory_method.js
Created August 24, 2011 17:05
Factory Method Pattern in JavaScript
var Patterns = {};
Patterns.Nokia = function(){
this.getPrice = function(){
return 200;
};
};
Patterns.Motorola = function(){
this.getPrice = function(){
@vorleakchy
vorleakchy / App.config
Created August 24, 2011 16:51
Art Of Test WebAii Tests Web UI
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="WebAii.Settings" type="ArtOfTest.WebAii.Core.SettingsConfigSectionHandler,ArtOfTest.WebAii, Version=1.1.900.0, Culture=neutral, PublicKeyToken=4FD5F65BE123776C"/>
</configSections>
<WebAii.Settings
annotateExecution="false"
baseUrl="http://www.google.com/"
clientReadyTimeout="50000"
defaultBrowser="InternetExplorer"
@vorleakchy
vorleakchy / concrete_factory.cs
Created August 24, 2011 16:29
Factory Method Design Pattern
public abstract class FactoryBase
{
public abstract Product FactoryMethod(int type);
}
public class ConcreteFactory : FactoryBase
{
public override Product FactoryMethod(int type)
{
switch (type)
@vorleakchy
vorleakchy / bargraph_horizontal.css
Created August 24, 2011 15:45
Vertical and Horizontal CSS Bar Graph
#bargraphHorizontal{
font:0.7em Arial;
border:1px solid #ccc;
}
#bargraphHorizontal th{
font-weight:normal;
}
#bargraphHorizontal td{
padding:1px 0;
margin:0;
@vorleakchy
vorleakchy / create_tables.sql
Created August 24, 2011 15:30
SQL Server 2005 Update Trigger Effect Multiple Rows
Create Table DeliveryType (
DeliveryTypeID int not null
Constraint pk_DeliveryType_DeliveryTypeID primary key,
DeliveryTypeDescription varchar(10) not null,
DeliveryCharge smallmoney not null
)
Create Table DeliveryTypeChanges (
ChangeID int identity(1,1) not null
Constraint pk_DeliveryTypeChanges_ChangeID primary key,
@vorleakchy
vorleakchy / program.cs
Created August 24, 2011 14:48
Strategy Design Pattern
using System;
namespace Patterns.Strategy
{
internal class Program
{
private static void Main(string[] args)
{
var array = new[] {"a", "b", "c", "d", "e"};
@vorleakchy
vorleakchy / create_products.rb
Created August 24, 2011 12:57
Using UUID as Primary Key in Ruby on Rails
create_table :products, :id => false do |t|
t.string :uuid, :limit => 36, :primary => true
end