Skip to content

Instantly share code, notes, and snippets.

View metaskills's full-sized avatar
🐙
Being Inkcellent to Each Other

Ken Collins metaskills

🐙
Being Inkcellent to Each Other
View GitHub Profile
module VersionedExtensions
def save_version?
false
end
def set_version(v)
self.version = v
update_without_callbacks
end
- (id)initWithCoder:(NSCoder *)coder {
if (self = [super initWithCoder:coder]) {
self.teams = [NSMutableArray
arrayWithObjects: @"Anaheim Aardvarks",
@"Baltimore Bats",
@"California Caterpillars",
@"Denver Donkeys",
nil];
self.addButtonItem = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonWasPressed)]
should 'not add locking conditions to sub selects' do
start_sql = "SELECT * FROM [people] WHERE ([people].[id] = 1) AND (id IN (SELECT id FROM CONTAINSTABLE(people,*,'test')))"
expected_sql = "SELECT * FROM [people] WITH (NOLOCK) WHERE ([people].[id] = 1) AND (id IN (SELECT id FROM CONTAINSTABLE(people,*,'test')))"
assert_equal expected_sql, Person.connection.send(:add_lock!,start_sql,{:lock => 'WITH (NOLOCK)'})
end
# Ruby: 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]
>> @unicode_data = "\344\270\200\344\272\21434\344\272\224\345\205\255"
=> "一二34五六"
>> d = SqlServerUnicode.create!(:nvarchar => @unicode_data)
=> #<SqlServerUnicode id: 5, nchar: nil, nvarchar: "一二34五六", ntext: nil, ntext_10: nil, nchar_10: nil, nvarchar_100: nil>
>> d.reload.nvarchar
=> "一二34五六"
>> exit
# Ruby: 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9]
# Using a both types of encoded string literals
>> ud1 = "\344\270\200\344\272\21434\344\272\224\345\205\255"
=> "\xE4\xB8\x80\xE4\xBA\x8C34\xE4\xBA\x94\xE5\x85\xAD"
>> d1 = SqlServerUnicode.create!(:nvarchar => ud1)
=> #<SqlServerUnicode id: 12, nchar: nil, nvarchar: "一二34五六", ntext: nil, ntext_10: nil, nchar_10: nil, nvarchar_100: nil>
>> d1.reload.nvarchar
=> "一二34五六"
>>
module Rack
class ZombieShotgun
ZOMBIE_AGENTS = [
/FrontPage/,
/Microsoft Office Protocol Discovery/,
/Microsoft Data Access Internet Publishing Provider/
].freeze
ZOMBIE_DIRS = ['_vti_bin','MSOffice','verify-VCNstrict','notified-VCNstrict'].to_set.freeze
# source ~/.git_auto_complete.sh
if [[ -x `which git` ]]; then
# Promt Work
function git-branch-name () {
git branch 2> /dev/null | grep ^\* | sed s/^\*\ //
}
2009-10-20 23:13:48.236 MyiPhoneApp[35225:207] [self savedLocation]: (
0,
<NSIndexPath 0x3c1ea80> 2 indexes [1, 0]
)
2009-10-20 23:13:50.791 MyiPhoneApp[35225:207] [self savedLocation]: (
0,
<NSIndexPath 0x3a23810> 2 indexes [1, 1]
)
2009-10-20 23:13:53.130 MyiPhoneApp[35225:207] [self savedLocation]: (
0,
module AttrStripper
module Stripper
def self.included(base)
base.alias_method_chain :write_attribute, :attr_stripper
end
def write_attribute_with_attr_stripper(attr, value)
value = value.dup.strip if value.is_a?(String)
write_attribute_without_attr_stripper(attr,value)
diff --git a/test/cases/adapter_test_sqlserver.rb b/test/cases/adapter_test_sqlserver.rb
index e988227..9be0339 100644
--- a/test/cases/adapter_test_sqlserver.rb
+++ b/test/cases/adapter_test_sqlserver.rb
@@ -384,6 +384,29 @@ class AdapterTestSqlserver < ActiveRecord::TestCase
end
+ context 'When testing a table with a custom identity column that so happens to have an [id] column too' do
+