Skip to content

Instantly share code, notes, and snippets.

# Object Counter for use in example on vipulnsward.com about Frozen
# Strings in Ruby
module ObjectCounter
def self.count
GC.disable
before_count = ObjectSpace.count_objects
yield
after_count = ObjectSpace.count_objects
after_count.each do |k,v|
after_count[k] = v.to_i - before_count[k].to_i
@vipulnsward
vipulnsward / make test
Created October 29, 2012 11:24
Potion Test
OS: Mac OSX Mountain Lion
make test
running API tests
............
OK (12 tests)
running GC tests
@vipulnsward
vipulnsward / CollectionProxy.rb
Created October 21, 2012 18:56
Override exists?
def exists?(conditions = :none)
return false if @association.owner.new_record?
super(conditions)
end
@vipulnsward
vipulnsward / method1.rb
Created July 2, 2012 10:02
Sample Method
def encode(bytearray [])
//process bytearray here
end
IRBuilder19.java:198:in `receiveArgs': java.lang.NoSuchFieldError: UNDEFINED
from IRBuilder19.java:252:in `receiveMethodArgs'
from IRBuilder.java:1782:in `defineNewMethod'
from IRBuilder.java:1801:in `buildDefn'
from IRBuilder.java:492:in `build'
from IRBuilder.java:2535:in `buildNewline'
from IRBuilder.java:523:in `build'
from IRBuilder.java:913:in `buildBlock'
from IRBuilder.java:478:in `build'
from IRBuilder.java:1084:in `buildClass'
@vipulnsward
vipulnsward / bccheker-unit-test
Created April 14, 2012 15:51
Test Run over BCChecker
==================================
/home/sward/.m2/repository/com/googlecode/japi-checker/reference-test-jar/0.1.4-SNAPSHOT/reference-test-jar-0.1.4-SNAPSHOT.jar
/home/sward/.m2/repository/com/googlecode/japi-checker/new-test-jar/0.1.4-SNAPSHOT/new-test-jar-0.1.4-SNAPSHOT.jar
==================================
/home/sward/.m2/repository/com/googlecode/japi-checker/reference-test-jar/0.1.4-SNAPSHOT/reference-test-jar-0.1.4-SNAPSHOT.jar
/home/sward/.m2/repository/com/googlecode/japi-checker/new-test-jar/0.1.4-SNAPSHOT/new-test-jar-0.1.4-SNAPSHOT.jar
class com/googlecode/japi/checker/tests/RemovedClass extends java/lang/Object {
- source: RemovedClass.java
- debug: null
+(m) <init> ()V null null